;(() => {
	"use strict"
	var t,
		e,
		s,
		i = {
			d: (t, e) => {
				for (var s in e) i.o(e, s) && !i.o(t, s) && Object.defineProperty(t, s, { enumerable: !0, get: e[s] })
			},
			o: (t, e) => Object.prototype.hasOwnProperty.call(t, e),
			r: t => {
				"undefined" != typeof Symbol &&
					Symbol.toStringTag &&
					Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }),
					Object.defineProperty(t, "__esModule", { value: !0 })
			}
		},
		r = {}
	i.r(r), i.d(r, { SdkBuilder: () => SdkBuilder })
	class DictArray {
		constructor() {
			this.values = {}
		}
		add(t, e) {
			this.getValuesAtKey(t).push(e)
		}
		remove(t, e) {
			const s = this.values[t]
			if (s) {
				const t = s.indexOf(e)
				t > -1 && s.splice(t, 1)
			}
		}
		getValuesAtKey(t) {
			const e = this.values[t] || []
			return (this.values[t] = e), e
		}
		valuesPerKey(t) {
			return this.getValuesAtKey(t).length
		}
		get keys() {
			return Object.keys(this.values)
		}
	}
	!(function (t) {
		;(t.EVENT = "postmessage.event"),
			(t.RESPONSE = "postmessage.response"),
			(t.OBSERVATION = "postmessage.observation"),
			(t.COLLECTION_UPDATE = "collection.updated")
	})(t || (t = {})),
		(function (t) {
			;(t.ITEM_ADDED = "collection.item.added"),
				(t.ITEM_REMOVED = "collection.item.removed"),
				(t.ITEM_UPDATED = "collection.item.updated"),
				(t.COLL_UPDATED = "collection.coll.updated")
		})(e || (e = {})),
		(function (t) {
			;(t.DISCONNECT = "sdk.client.disconnect"),
				(t.ACTION = "postmessage.action"),
				(t.EVENT_SUB = "postmessage.subscribe"),
				(t.EVENT_UNSUB = "postmessage.unsubscribe"),
				(t.OBSERVABLE_SUB = "postmessage.observe"),
				(t.OBSERVABLE_UNSUB = "postmessage.unobserve"),
				(t.COLLECTION_SUB = "collection.sub"),
				(t.COLLECTION_UNSUB = "collection.unsub")
		})(s || (s = {}))
	class EventObserverAdaptor {
		constructor(e) {
			;(this.observer = e), (this.messageType = t.EVENT)
		}
		notify(t) {
			this.observer.receiveEvent(t)
		}
	}
	class EventSubscribeMessage {
		constructor(t) {
			;(this.type = s.EVENT_SUB), (this.payload = { subscription: t })
		}
	}
	class EventUnsubscribeMessage {
		constructor(t) {
			;(this.type = s.EVENT_UNSUB), (this.payload = { subscription: t })
		}
	}
	class EventInterfaceBuilder {
		constructor(t) {
			;(this.messenger = t), (this.eventHandlers = new DictArray())
			const e = new (class EventFacade {
				constructor(t) {
					this.eventHandler = t
				}
				receiveEvent(t) {
					this.eventHandler.receiveEvent(t)
				}
			})(this)
			;(this.eventObserver = new EventObserverAdaptor(e)), this.messenger.addObserver(this.eventObserver)
		}
		build() {
			return { on: (t, e) => this.subscribe(t, e), off: (t, e) => this.unsubscribe(t, e) }
		}
		dispose() {
			for (const t of this.eventHandlers.keys) this.messenger.send(new EventUnsubscribeMessage(t))
			this.messenger.removeObserver(this.eventObserver)
		}
		receiveEvent(t) {
			const e = this.eventHandlers.getValuesAtKey(t.eventType)
			if (e) for (const s of e) t.eventData ? s(...t.eventData) : s()
		}
		subscribe(t, e) {
			0 === this.eventHandlers.valuesPerKey(t) && this.messenger.send(new EventSubscribeMessage(t)),
				this.eventHandlers.add(t, e)
		}
		unsubscribe(t, e) {
			this.eventHandlers.remove(t, e),
				0 === this.eventHandlers.valuesPerKey(t) && this.messenger.send(new EventUnsubscribeMessage(t))
		}
	}
	class EnumInterfaceBuilder {
		constructor() {}
		build(t) {
			const e = {}
			for (const s of Object.keys(t)) {
				const i = t[s]
				if (i) {
					const t = e[i.namespace] || {}
					;(e[i.namespace] = t), (t[i.name] = i.values)
				}
			}
			return e
		}
		dispose() {}
	}
	class ResponseObserverAdaptor {
		constructor(e) {
			;(this.receiver = e), (this.messageType = t.RESPONSE)
		}
		notify(t) {
			this.receiver.receiveResponse(t)
		}
	}
	class ActionMessage {
		constructor(t, e, i) {
			;(this.type = s.ACTION), (this.payload = { uid: t, targetFunction: e, params: i })
		}
	}
	function n(t, e, s) {
		const i = {},
			r = void 0 === s ? t.length : s
		for (let s = 0; s < r; ++s) i[t[s]] = e[s]
		return i
	}
	class FunctionRegistration {
		constructor(t) {
			;(this.messenger = t), (this.responseResolvers = {}), (this.currentMsgId = 0), (this.routines = {})
			const e = new (class FunctionFacade {
				constructor(t) {
					this.functions = t
				}
				receiveResponse(t) {
					this.functions.receiveResponse(t)
				}
			})(this)
			;(this.responseObserver = new ResponseObserverAdaptor(e)), this.messenger.addObserver(this.responseObserver)
		}
		initRoutines(t, ...e) {
			for (const s of e) {
				const e = new s(t)
				this.routines[e.key] = e
			}
		}
		dispose() {
			this.messenger.removeObserver(this.responseObserver)
			for (const t in this.responseResolvers) {
				const e = this.responseResolvers[t]
				e && e.reject(`SDK client was disconnected before ${e.funcKey} was fulfilled`)
			}
		}
		register(t, e) {
			return (...s) => this.dispatchAction(t, e, ...s)
		}
		async dispatchAction(t, e, ...s) {
			return new Promise((i, r) => {
				this.responseResolvers[this.currentMsgId] = { funcKey: t, funcDef: e, resolve: i, reject: r }
				const o = this.getSubRoutineFromDef(e),
					a = (function (t, e, s = !1) {
						if (s) {
							const s = n(t, e, t.length - 1),
								i = t.length - 1
							return (s[t[i]] = e.slice(i)), s
						}
						return n(t, e)
					})(o ? o.argsDef.argNames : e.args, s, o ? o.argsDef.varArg : e.varArg),
					h = o ? o.buildMessageData(this.currentMsgId, a) : a
				this.messenger.send(new ActionMessage(this.currentMsgId, t, h)), ++this.currentMsgId
			})
		}
		async receiveResponse(t) {
			const e = this.responseResolvers[t.uid]
			if (e)
				if (t.success) {
					const s = this.getSubRoutineFromDef(e.funcDef)
					s ? e.resolve(await s.onResponse(t.uid, t.message)) : e.resolve(t.message)
				} else e.reject(t.error)
			delete this.responseResolvers[t.uid]
		}
		getSubRoutineFromDef(t) {
			if (t.subRoutine) {
				const e = this.routines[t.subRoutine]
				if (!e) throw new Error(`${t.subRoutine} sub-routine was not provided for ${t}`)
				return e
			}
			return null
		}
	}
	class FunctionInterfaceBuilder {
		constructor(t) {
			this.registration = t
		}
		build(t) {
			const e = {}
			for (const s of Object.keys(t)) {
				const i = t[s]
				if (i) {
					const t = e[i.namespace] || {}
					;(e[i.namespace] = t), (t[i.name] = this.registration.register(s, i))
				}
			}
			return e
		}
	}
	class ObservationObserverAdaptor {
		constructor(e) {
			;(this.observer = e), (this.messageType = t.OBSERVATION)
		}
		notify(t) {
			this.observer.observe(t)
		}
	}
	class ObservableSubscribeMessage {
		constructor(t) {
			;(this.type = s.OBSERVABLE_SUB), (this.payload = { observableKey: t })
		}
	}
	class ObservableUnsubscribeMessage {
		constructor(t) {
			;(this.type = s.OBSERVABLE_UNSUB), (this.payload = { observableKey: t })
		}
	}
	class ObservableRegistration {
		constructor(t) {
			;(this.messenger = t),
				(this.dataCache = {}),
				(this.subscribedObservers = new DictArray()),
				(this.observersToRemove = new DictArray()),
				(this.objectFactories = {}),
				(this.observableToFactoryMap = {})
			const e = new (class ObservableFacade {
				constructor(t) {
					this.observables = t
				}
				observe(t) {
					this.observables.observe(t)
				}
			})(this)
			;(this.observableObserver = new ObservationObserverAdaptor(e)),
				this.messenger.addObserver(this.observableObserver)
		}
		dispose() {
			for (const t of this.subscribedObservers.keys) this.messenger.send(new ObservableUnsubscribeMessage(t))
			this.messenger.removeObserver(this.observableObserver)
		}
		register(t, e) {
			const s = this
			if (e) {
				const s = this.objectFactories[e]
				if (!s) throw new Error(`${e} factory was not provided for ${t}`)
				this.observableToFactoryMap[t] = s
			}
			return new (class Observable {
				subscribe(e) {
					return s.subscribe(t, e)
				}
				waitUntil(e) {
					return s.waitUntil(t, e)
				}
			})()
		}
		initObjectFactories(t, ...e) {
			for (const s of e) {
				const e = new s(t)
				this.objectFactories[e.observableKey] = e
			}
		}
		subscribe(t, e) {
			if ("function" == typeof e) return this.subscribeWithCallback(t, e)
			if (e.onChanged && "function" == typeof e.onChanged) return this.subscribeWithObserver(t, e)
			throw Error(
				"The argument provided to subscribe was not a valid observer\nExpected a function or an object with an `onChanged` function"
			)
		}
		subscribeWithCallback(t, e) {
			return this.addObserver(
				t,
				new (class CallbackAdaptor {
					onChanged(t) {
						e(t)
					}
				})()
			)
		}
		subscribeWithObserver(t, e) {
			return this.addObserver(
				t,
				new (class ObserverAdaptor {
					onChanged(t) {
						e.onChanged(t)
					}
				})()
			)
		}
		waitUntil(t, e) {
			if ("function" == typeof e) return this.waitWithCallback(t, e)
			if (e.hasOwnProperty("waitUntil") && "function" == typeof e.waitUntil) return this.waitWithWaiter(t, e)
			throw Error(
				"The argument provided to waitUntil was not a valid waiter\nExpected a function or an object with an `waitUntil` function"
			)
		}
		waitWithCallback(t, e) {
			class WaiterCallbackAdaptor {
				constructor(t, e) {
					;(this.obsIntfBuilder = t), (this.res = e)
				}
				onChanged(s) {
					e(s) && (this.res(), this.obsIntfBuilder.observersToRemove.add(t, this))
				}
			}
			return new Promise(e => {
				this.addObserver(t, new WaiterCallbackAdaptor(this, e))
			})
		}
		waitWithWaiter(t, e) {
			class WaiterAdaptor {
				constructor(t, e) {
					;(this.obsIntfBuilder = t), (this.res = e)
				}
				onChanged(s) {
					e.waitUntil(s) && (this.res(), this.obsIntfBuilder.observersToRemove.add(t, this))
				}
			}
			return new Promise(e => {
				this.addObserver(t, new WaiterAdaptor(this, e))
			})
		}
		observe(t) {
			const { observableKey: e, observableData: s } = t,
				i = this.observableToFactoryMap[e]
			this.dataCache[t.observableKey] = i ? i.create(s, this.dataCache[t.observableKey]) : s
			const r = this.subscribedObservers.getValuesAtKey(e)
			if (r) for (const e of r) e.onChanged(this.dataCache[t.observableKey])
			this.removeDeadObservers(e)
		}
		addObserver(t, e) {
			0 === this.subscribedObservers.valuesPerKey(t) && this.messenger.send(new ObservableSubscribeMessage(t)),
				this.subscribedObservers.add(t, e)
			const s = this.dataCache[t]
			s && (e.onChanged(s), this.removeDeadObservers(t))
			const i = this
			return new (class Cancellable {
				cancel() {
					i.removeObserver(t, e)
				}
			})()
		}
		removeObserver(t, e) {
			this.subscribedObservers.remove(t, e),
				0 === this.subscribedObservers.valuesPerKey(t) && this.messenger.send(new ObservableUnsubscribeMessage(t))
		}
		removeDeadObservers(t) {
			const e = this.observersToRemove.getValuesAtKey(t)
			for (const s of e) this.removeObserver(t, s), this.observersToRemove.remove(t, s)
		}
	}
	class ObservableInterfaceBuilder {
		constructor(t) {
			this.registration = t
		}
		build(t) {
			const e = {}
			for (const s of Object.keys(t)) {
				const i = t[s]
				if (i) {
					const t = e[i.namespace] || {}
					;(e[i.namespace] = t), (t[i.name] = this.registration.register(s, i.objectFactory))
				}
			}
			return e
		}
	}
	class CollectionUpdateObserverAdaptor {
		constructor(e) {
			;(this.observer = e), (this.messageType = t.COLLECTION_UPDATE)
		}
		notify(t) {
			this.observer.observe(t)
		}
	}
	class CollectionSubcribeMessage {
		constructor(t) {
			;(this.type = s.COLLECTION_SUB), (this.payload = { collectionKey: t })
		}
	}
	class CollectionUnsubscribeMessage {
		constructor(t) {
			;(this.type = s.COLLECTION_UNSUB), (this.payload = { collectionKey: t })
		}
	}
	class CollectionRegistration {
		constructor(t) {
			;(this.messenger = t),
				(this.collectionCache = {}),
				(this.observers = new DictArray()),
				(this.elementFactories = {}),
				(this.collectionToElementFactoryMap = {})
			;(this.collectionUpdateObserver = new CollectionUpdateObserverAdaptor(
				new (class CollectionUpdateFacade {
					constructor(t) {
						this.collectionBuilder = t
					}
					observe(t) {
						this.collectionBuilder.observe(t)
					}
				})(this)
			)),
				this.messenger.addObserver(this.collectionUpdateObserver)
		}
		dispose() {
			for (const t of this.observers.keys) this.messenger.send(new CollectionUnsubscribeMessage(t))
			this.messenger.removeObserver(this.collectionUpdateObserver)
		}
		register(t, e) {
			const s = this
			if (e) {
				const s = this.elementFactories[e]
				if (!s) throw new Error(`${e} element factory was not provided for ${t}`)
				this.collectionToElementFactoryMap[t] = s
			}
			return new (class Collection {
				subscribe(e) {
					return s.subscribe(t, e)
				}
			})()
		}
		initElementFactories(t, ...e) {
			for (const s of e) {
				const e = new s(t)
				this.elementFactories[e.collectionKey] = e
			}
		}
		observe(t) {
			switch (t.operation) {
				case e.ITEM_ADDED: {
					const { collectionKey: e, collectionIndex: s, item: i } = t
					this.onItemAdded(e, s, i)
					break
				}
				case e.ITEM_REMOVED: {
					const { collectionKey: e, collectionIndex: s } = t
					this.onItemRemoved(e, s)
					break
				}
				case e.ITEM_UPDATED: {
					const { collectionKey: e, collectionIndex: s, item: i } = t
					this.onItemUpdated(e, s, i)
					break
				}
				case e.COLL_UPDATED: {
					const { collectionKey: e } = t
					this.onCollectionUpdated(e)
					break
				}
			}
		}
		onItemAdded(t, e, s) {
			const i = this.collectionCache[t] || {}
			this.collectionCache[t] = i
			const r = this.collectionToElementFactoryMap[t]
			i[e] = r ? r.create(s) : s
			const n = this.observers.getValuesAtKey(t)
			for (const t of n) t.onAdded && t.onAdded(e, i[e], i)
		}
		onItemRemoved(t, e) {
			const s = this.collectionCache[t]
			if (!s) return
			const i = s[e]
			if ((delete s[e], i)) {
				const r = this.observers.getValuesAtKey(t)
				for (const t of r) t.onRemoved && t.onRemoved(e, i, s)
			}
		}
		onItemUpdated(t, e, s) {
			const i = this.collectionCache[t]
			if (!i) return
			const r = this.collectionToElementFactoryMap[t]
			r ? r.create(s, i[e]) : (i[e] = s)
			const n = this.observers.getValuesAtKey(t)
			for (const t of n) t.onUpdated && t.onUpdated(e, s, i)
		}
		onCollectionUpdated(t) {
			const e = this.collectionCache[t]
			if (!e) return
			const s = this.observers.getValuesAtKey(t)
			for (const t of s) t.onCollectionUpdated && t.onCollectionUpdated(e)
		}
		subscribe(t, e) {
			0 === this.observers.valuesPerKey(t) && this.messenger.send(new CollectionSubcribeMessage(t)),
				this.observers.add(t, e)
			const s = this.collectionCache[t]
			if (s) {
				for (const t of Object.keys(s)) e.onAdded && e.onAdded(t, s[t], s)
				e.onCollectionUpdated && e.onCollectionUpdated(s)
			}
			return { cancel: () => this.unsubscribe(t, e) }
		}
		unsubscribe(t, e) {
			this.observers.remove(t, e),
				0 === this.observers.valuesPerKey(t) &&
					(this.messenger.send(new CollectionUnsubscribeMessage(t)), delete this.collectionCache[t])
		}
	}
	class CollectionInterfaceBuilder {
		constructor(t) {
			this.registration = t
		}
		build(t) {
			const e = {}
			for (const s of Object.keys(t)) {
				const i = t[s]
				if (i) {
					const t = e[i.namespace] || {}
					;(e[i.namespace] = t), (t[i.name] = this.registration.register(s, i.elementFactory))
				}
			}
			return e
		}
	}
	const o = []
	for (let t = 0; t < 256; t++) o[t] = (t < 16 ? "0" : "") + t.toString(16)
	Math.PI, Math.PI
	function a(t, e, s) {
		return Math.max(e, Math.min(s, t))
	}
	class Quaternion {
		constructor(t = 0, e = 0, s = 0, i = 1) {
			;(this._x = t), (this._y = e), (this._z = s), (this._w = i)
		}
		static slerp(t, e, s, i) {
			return (
				console.warn(
					"THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."
				),
				s.slerpQuaternions(t, e, i)
			)
		}
		static slerpFlat(t, e, s, i, r, n, o) {
			let a = s[i + 0],
				h = s[i + 1],
				c = s[i + 2],
				l = s[i + 3]
			const u = r[n + 0],
				d = r[n + 1],
				m = r[n + 2],
				p = r[n + 3]
			if (0 === o) return (t[e + 0] = a), (t[e + 1] = h), (t[e + 2] = c), void (t[e + 3] = l)
			if (1 === o) return (t[e + 0] = u), (t[e + 1] = d), (t[e + 2] = m), void (t[e + 3] = p)
			if (l !== p || a !== u || h !== d || c !== m) {
				let t = 1 - o
				const e = a * u + h * d + c * m + l * p,
					s = e >= 0 ? 1 : -1,
					i = 1 - e * e
				if (i > Number.EPSILON) {
					const r = Math.sqrt(i),
						n = Math.atan2(r, e * s)
					;(t = Math.sin(t * n) / r), (o = Math.sin(o * n) / r)
				}
				const r = o * s
				if (((a = a * t + u * r), (h = h * t + d * r), (c = c * t + m * r), (l = l * t + p * r), t === 1 - o)) {
					const t = 1 / Math.sqrt(a * a + h * h + c * c + l * l)
					;(a *= t), (h *= t), (c *= t), (l *= t)
				}
			}
			;(t[e] = a), (t[e + 1] = h), (t[e + 2] = c), (t[e + 3] = l)
		}
		static multiplyQuaternionsFlat(t, e, s, i, r, n) {
			const o = s[i],
				a = s[i + 1],
				h = s[i + 2],
				c = s[i + 3],
				l = r[n],
				u = r[n + 1],
				d = r[n + 2],
				m = r[n + 3]
			return (
				(t[e] = o * m + c * l + a * d - h * u),
				(t[e + 1] = a * m + c * u + h * l - o * d),
				(t[e + 2] = h * m + c * d + o * u - a * l),
				(t[e + 3] = c * m - o * l - a * u - h * d),
				t
			)
		}
		get x() {
			return this._x
		}
		set x(t) {
			;(this._x = t), this._onChangeCallback()
		}
		get y() {
			return this._y
		}
		set y(t) {
			;(this._y = t), this._onChangeCallback()
		}
		get z() {
			return this._z
		}
		set z(t) {
			;(this._z = t), this._onChangeCallback()
		}
		get w() {
			return this._w
		}
		set w(t) {
			;(this._w = t), this._onChangeCallback()
		}
		set(t, e, s, i) {
			return (this._x = t), (this._y = e), (this._z = s), (this._w = i), this._onChangeCallback(), this
		}
		clone() {
			return new this.constructor(this._x, this._y, this._z, this._w)
		}
		copy(t) {
			return (this._x = t.x), (this._y = t.y), (this._z = t.z), (this._w = t.w), this._onChangeCallback(), this
		}
		setFromEuler(t, e) {
			if (!t || !t.isEuler)
				throw new Error(
					"THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."
				)
			const s = t._x,
				i = t._y,
				r = t._z,
				n = t._order,
				o = Math.cos,
				a = Math.sin,
				h = o(s / 2),
				c = o(i / 2),
				l = o(r / 2),
				u = a(s / 2),
				d = a(i / 2),
				m = a(r / 2)
			switch (n) {
				case "XYZ":
					;(this._x = u * c * l + h * d * m),
						(this._y = h * d * l - u * c * m),
						(this._z = h * c * m + u * d * l),
						(this._w = h * c * l - u * d * m)
					break
				case "YXZ":
					;(this._x = u * c * l + h * d * m),
						(this._y = h * d * l - u * c * m),
						(this._z = h * c * m - u * d * l),
						(this._w = h * c * l + u * d * m)
					break
				case "ZXY":
					;(this._x = u * c * l - h * d * m),
						(this._y = h * d * l + u * c * m),
						(this._z = h * c * m + u * d * l),
						(this._w = h * c * l - u * d * m)
					break
				case "ZYX":
					;(this._x = u * c * l - h * d * m),
						(this._y = h * d * l + u * c * m),
						(this._z = h * c * m - u * d * l),
						(this._w = h * c * l + u * d * m)
					break
				case "YZX":
					;(this._x = u * c * l + h * d * m),
						(this._y = h * d * l + u * c * m),
						(this._z = h * c * m - u * d * l),
						(this._w = h * c * l - u * d * m)
					break
				case "XZY":
					;(this._x = u * c * l - h * d * m),
						(this._y = h * d * l - u * c * m),
						(this._z = h * c * m + u * d * l),
						(this._w = h * c * l + u * d * m)
					break
				default:
					console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + n)
			}
			return !1 !== e && this._onChangeCallback(), this
		}
		setFromAxisAngle(t, e) {
			const s = e / 2,
				i = Math.sin(s)
			return (
				(this._x = t.x * i),
				(this._y = t.y * i),
				(this._z = t.z * i),
				(this._w = Math.cos(s)),
				this._onChangeCallback(),
				this
			)
		}
		setFromRotationMatrix(t) {
			const e = t.elements,
				s = e[0],
				i = e[4],
				r = e[8],
				n = e[1],
				o = e[5],
				a = e[9],
				h = e[2],
				c = e[6],
				l = e[10],
				u = s + o + l
			if (u > 0) {
				const t = 0.5 / Math.sqrt(u + 1)
				;(this._w = 0.25 / t), (this._x = (c - a) * t), (this._y = (r - h) * t), (this._z = (n - i) * t)
			} else if (s > o && s > l) {
				const t = 2 * Math.sqrt(1 + s - o - l)
				;(this._w = (c - a) / t), (this._x = 0.25 * t), (this._y = (i + n) / t), (this._z = (r + h) / t)
			} else if (o > l) {
				const t = 2 * Math.sqrt(1 + o - s - l)
				;(this._w = (r - h) / t), (this._x = (i + n) / t), (this._y = 0.25 * t), (this._z = (a + c) / t)
			} else {
				const t = 2 * Math.sqrt(1 + l - s - o)
				;(this._w = (n - i) / t), (this._x = (r + h) / t), (this._y = (a + c) / t), (this._z = 0.25 * t)
			}
			return this._onChangeCallback(), this
		}
		setFromUnitVectors(t, e) {
			let s = t.dot(e) + 1
			return (
				s < Number.EPSILON
					? ((s = 0),
					  Math.abs(t.x) > Math.abs(t.z)
							? ((this._x = -t.y), (this._y = t.x), (this._z = 0), (this._w = s))
							: ((this._x = 0), (this._y = -t.z), (this._z = t.y), (this._w = s)))
					: ((this._x = t.y * e.z - t.z * e.y),
					  (this._y = t.z * e.x - t.x * e.z),
					  (this._z = t.x * e.y - t.y * e.x),
					  (this._w = s)),
				this.normalize()
			)
		}
		angleTo(t) {
			return 2 * Math.acos(Math.abs(a(this.dot(t), -1, 1)))
		}
		rotateTowards(t, e) {
			const s = this.angleTo(t)
			if (0 === s) return this
			const i = Math.min(1, e / s)
			return this.slerp(t, i), this
		}
		identity() {
			return this.set(0, 0, 0, 1)
		}
		invert() {
			return this.conjugate()
		}
		conjugate() {
			return (this._x *= -1), (this._y *= -1), (this._z *= -1), this._onChangeCallback(), this
		}
		dot(t) {
			return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w
		}
		lengthSq() {
			return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
		}
		length() {
			return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
		}
		normalize() {
			let t = this.length()
			return (
				0 === t
					? ((this._x = 0), (this._y = 0), (this._z = 0), (this._w = 1))
					: ((t = 1 / t),
					  (this._x = this._x * t),
					  (this._y = this._y * t),
					  (this._z = this._z * t),
					  (this._w = this._w * t)),
				this._onChangeCallback(),
				this
			)
		}
		multiply(t, e) {
			return void 0 !== e
				? (console.warn(
						"THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."
				  ),
				  this.multiplyQuaternions(t, e))
				: this.multiplyQuaternions(this, t)
		}
		premultiply(t) {
			return this.multiplyQuaternions(t, this)
		}
		multiplyQuaternions(t, e) {
			const s = t._x,
				i = t._y,
				r = t._z,
				n = t._w,
				o = e._x,
				a = e._y,
				h = e._z,
				c = e._w
			return (
				(this._x = s * c + n * o + i * h - r * a),
				(this._y = i * c + n * a + r * o - s * h),
				(this._z = r * c + n * h + s * a - i * o),
				(this._w = n * c - s * o - i * a - r * h),
				this._onChangeCallback(),
				this
			)
		}
		slerp(t, e) {
			if (0 === e) return this
			if (1 === e) return this.copy(t)
			const s = this._x,
				i = this._y,
				r = this._z,
				n = this._w
			let o = n * t._w + s * t._x + i * t._y + r * t._z
			if (
				(o < 0 ? ((this._w = -t._w), (this._x = -t._x), (this._y = -t._y), (this._z = -t._z), (o = -o)) : this.copy(t),
				o >= 1)
			)
				return (this._w = n), (this._x = s), (this._y = i), (this._z = r), this
			const a = 1 - o * o
			if (a <= Number.EPSILON) {
				const t = 1 - e
				return (
					(this._w = t * n + e * this._w),
					(this._x = t * s + e * this._x),
					(this._y = t * i + e * this._y),
					(this._z = t * r + e * this._z),
					this.normalize(),
					this._onChangeCallback(),
					this
				)
			}
			const h = Math.sqrt(a),
				c = Math.atan2(h, o),
				l = Math.sin((1 - e) * c) / h,
				u = Math.sin(e * c) / h
			return (
				(this._w = n * l + this._w * u),
				(this._x = s * l + this._x * u),
				(this._y = i * l + this._y * u),
				(this._z = r * l + this._z * u),
				this._onChangeCallback(),
				this
			)
		}
		slerpQuaternions(t, e, s) {
			this.copy(t).slerp(e, s)
		}
		equals(t) {
			return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w
		}
		fromArray(t, e = 0) {
			return (
				(this._x = t[e]),
				(this._y = t[e + 1]),
				(this._z = t[e + 2]),
				(this._w = t[e + 3]),
				this._onChangeCallback(),
				this
			)
		}
		toArray(t = [], e = 0) {
			return (t[e] = this._x), (t[e + 1] = this._y), (t[e + 2] = this._z), (t[e + 3] = this._w), t
		}
		fromBufferAttribute(t, e) {
			return (this._x = t.getX(e)), (this._y = t.getY(e)), (this._z = t.getZ(e)), (this._w = t.getW(e)), this
		}
		_onChange(t) {
			return (this._onChangeCallback = t), this
		}
		_onChangeCallback() {}
	}
	Quaternion.prototype.isQuaternion = !0
	class Vector3 {
		constructor(t = 0, e = 0, s = 0) {
			;(this.x = t), (this.y = e), (this.z = s)
		}
		set(t, e, s) {
			return void 0 === s && (s = this.z), (this.x = t), (this.y = e), (this.z = s), this
		}
		setScalar(t) {
			return (this.x = t), (this.y = t), (this.z = t), this
		}
		setX(t) {
			return (this.x = t), this
		}
		setY(t) {
			return (this.y = t), this
		}
		setZ(t) {
			return (this.z = t), this
		}
		setComponent(t, e) {
			switch (t) {
				case 0:
					this.x = e
					break
				case 1:
					this.y = e
					break
				case 2:
					this.z = e
					break
				default:
					throw new Error("index is out of range: " + t)
			}
			return this
		}
		getComponent(t) {
			switch (t) {
				case 0:
					return this.x
				case 1:
					return this.y
				case 2:
					return this.z
				default:
					throw new Error("index is out of range: " + t)
			}
		}
		clone() {
			return new this.constructor(this.x, this.y, this.z)
		}
		copy(t) {
			return (this.x = t.x), (this.y = t.y), (this.z = t.z), this
		}
		add(t, e) {
			return void 0 !== e
				? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
				  this.addVectors(t, e))
				: ((this.x += t.x), (this.y += t.y), (this.z += t.z), this)
		}
		addScalar(t) {
			return (this.x += t), (this.y += t), (this.z += t), this
		}
		addVectors(t, e) {
			return (this.x = t.x + e.x), (this.y = t.y + e.y), (this.z = t.z + e.z), this
		}
		addScaledVector(t, e) {
			return (this.x += t.x * e), (this.y += t.y * e), (this.z += t.z * e), this
		}
		sub(t, e) {
			return void 0 !== e
				? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
				  this.subVectors(t, e))
				: ((this.x -= t.x), (this.y -= t.y), (this.z -= t.z), this)
		}
		subScalar(t) {
			return (this.x -= t), (this.y -= t), (this.z -= t), this
		}
		subVectors(t, e) {
			return (this.x = t.x - e.x), (this.y = t.y - e.y), (this.z = t.z - e.z), this
		}
		multiply(t, e) {
			return void 0 !== e
				? (console.warn(
						"THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."
				  ),
				  this.multiplyVectors(t, e))
				: ((this.x *= t.x), (this.y *= t.y), (this.z *= t.z), this)
		}
		multiplyScalar(t) {
			return (this.x *= t), (this.y *= t), (this.z *= t), this
		}
		multiplyVectors(t, e) {
			return (this.x = t.x * e.x), (this.y = t.y * e.y), (this.z = t.z * e.z), this
		}
		applyEuler(t) {
			return (
				(t && t.isEuler) ||
					console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),
				this.applyQuaternion(c.setFromEuler(t))
			)
		}
		applyAxisAngle(t, e) {
			return this.applyQuaternion(c.setFromAxisAngle(t, e))
		}
		applyMatrix3(t) {
			const e = this.x,
				s = this.y,
				i = this.z,
				r = t.elements
			return (
				(this.x = r[0] * e + r[3] * s + r[6] * i),
				(this.y = r[1] * e + r[4] * s + r[7] * i),
				(this.z = r[2] * e + r[5] * s + r[8] * i),
				this
			)
		}
		applyNormalMatrix(t) {
			return this.applyMatrix3(t).normalize()
		}
		applyMatrix4(t) {
			const e = this.x,
				s = this.y,
				i = this.z,
				r = t.elements,
				n = 1 / (r[3] * e + r[7] * s + r[11] * i + r[15])
			return (
				(this.x = (r[0] * e + r[4] * s + r[8] * i + r[12]) * n),
				(this.y = (r[1] * e + r[5] * s + r[9] * i + r[13]) * n),
				(this.z = (r[2] * e + r[6] * s + r[10] * i + r[14]) * n),
				this
			)
		}
		applyQuaternion(t) {
			const e = this.x,
				s = this.y,
				i = this.z,
				r = t.x,
				n = t.y,
				o = t.z,
				a = t.w,
				h = a * e + n * i - o * s,
				c = a * s + o * e - r * i,
				l = a * i + r * s - n * e,
				u = -r * e - n * s - o * i
			return (
				(this.x = h * a + u * -r + c * -o - l * -n),
				(this.y = c * a + u * -n + l * -r - h * -o),
				(this.z = l * a + u * -o + h * -n - c * -r),
				this
			)
		}
		project(t) {
			return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)
		}
		unproject(t) {
			return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)
		}
		transformDirection(t) {
			const e = this.x,
				s = this.y,
				i = this.z,
				r = t.elements
			return (
				(this.x = r[0] * e + r[4] * s + r[8] * i),
				(this.y = r[1] * e + r[5] * s + r[9] * i),
				(this.z = r[2] * e + r[6] * s + r[10] * i),
				this.normalize()
			)
		}
		divide(t) {
			return (this.x /= t.x), (this.y /= t.y), (this.z /= t.z), this
		}
		divideScalar(t) {
			return this.multiplyScalar(1 / t)
		}
		min(t) {
			return (this.x = Math.min(this.x, t.x)), (this.y = Math.min(this.y, t.y)), (this.z = Math.min(this.z, t.z)), this
		}
		max(t) {
			return (this.x = Math.max(this.x, t.x)), (this.y = Math.max(this.y, t.y)), (this.z = Math.max(this.z, t.z)), this
		}
		clamp(t, e) {
			return (
				(this.x = Math.max(t.x, Math.min(e.x, this.x))),
				(this.y = Math.max(t.y, Math.min(e.y, this.y))),
				(this.z = Math.max(t.z, Math.min(e.z, this.z))),
				this
			)
		}
		clampScalar(t, e) {
			return (
				(this.x = Math.max(t, Math.min(e, this.x))),
				(this.y = Math.max(t, Math.min(e, this.y))),
				(this.z = Math.max(t, Math.min(e, this.z))),
				this
			)
		}
		clampLength(t, e) {
			const s = this.length()
			return this.divideScalar(s || 1).multiplyScalar(Math.max(t, Math.min(e, s)))
		}
		floor() {
			return (this.x = Math.floor(this.x)), (this.y = Math.floor(this.y)), (this.z = Math.floor(this.z)), this
		}
		ceil() {
			return (this.x = Math.ceil(this.x)), (this.y = Math.ceil(this.y)), (this.z = Math.ceil(this.z)), this
		}
		round() {
			return (this.x = Math.round(this.x)), (this.y = Math.round(this.y)), (this.z = Math.round(this.z)), this
		}
		roundToZero() {
			return (
				(this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x)),
				(this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y)),
				(this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z)),
				this
			)
		}
		negate() {
			return (this.x = -this.x), (this.y = -this.y), (this.z = -this.z), this
		}
		dot(t) {
			return this.x * t.x + this.y * t.y + this.z * t.z
		}
		lengthSq() {
			return this.x * this.x + this.y * this.y + this.z * this.z
		}
		length() {
			return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
		}
		manhattanLength() {
			return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
		}
		normalize() {
			return this.divideScalar(this.length() || 1)
		}
		setLength(t) {
			return this.normalize().multiplyScalar(t)
		}
		lerp(t, e) {
			return (this.x += (t.x - this.x) * e), (this.y += (t.y - this.y) * e), (this.z += (t.z - this.z) * e), this
		}
		lerpVectors(t, e, s) {
			return (this.x = t.x + (e.x - t.x) * s), (this.y = t.y + (e.y - t.y) * s), (this.z = t.z + (e.z - t.z) * s), this
		}
		cross(t, e) {
			return void 0 !== e
				? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
				  this.crossVectors(t, e))
				: this.crossVectors(this, t)
		}
		crossVectors(t, e) {
			const s = t.x,
				i = t.y,
				r = t.z,
				n = e.x,
				o = e.y,
				a = e.z
			return (this.x = i * a - r * o), (this.y = r * n - s * a), (this.z = s * o - i * n), this
		}
		projectOnVector(t) {
			const e = t.lengthSq()
			if (0 === e) return this.set(0, 0, 0)
			const s = t.dot(this) / e
			return this.copy(t).multiplyScalar(s)
		}
		projectOnPlane(t) {
			return h.copy(this).projectOnVector(t), this.sub(h)
		}
		reflect(t) {
			return this.sub(h.copy(t).multiplyScalar(2 * this.dot(t)))
		}
		angleTo(t) {
			const e = Math.sqrt(this.lengthSq() * t.lengthSq())
			if (0 === e) return Math.PI / 2
			const s = this.dot(t) / e
			return Math.acos(a(s, -1, 1))
		}
		distanceTo(t) {
			return Math.sqrt(this.distanceToSquared(t))
		}
		distanceToSquared(t) {
			const e = this.x - t.x,
				s = this.y - t.y,
				i = this.z - t.z
			return e * e + s * s + i * i
		}
		manhattanDistanceTo(t) {
			return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z)
		}
		setFromSpherical(t) {
			return this.setFromSphericalCoords(t.radius, t.phi, t.theta)
		}
		setFromSphericalCoords(t, e, s) {
			const i = Math.sin(e) * t
			return (this.x = i * Math.sin(s)), (this.y = Math.cos(e) * t), (this.z = i * Math.cos(s)), this
		}
		setFromCylindrical(t) {
			return this.setFromCylindricalCoords(t.radius, t.theta, t.y)
		}
		setFromCylindricalCoords(t, e, s) {
			return (this.x = t * Math.sin(e)), (this.y = s), (this.z = t * Math.cos(e)), this
		}
		setFromMatrixPosition(t) {
			const e = t.elements
			return (this.x = e[12]), (this.y = e[13]), (this.z = e[14]), this
		}
		setFromMatrixScale(t) {
			const e = this.setFromMatrixColumn(t, 0).length(),
				s = this.setFromMatrixColumn(t, 1).length(),
				i = this.setFromMatrixColumn(t, 2).length()
			return (this.x = e), (this.y = s), (this.z = i), this
		}
		setFromMatrixColumn(t, e) {
			return this.fromArray(t.elements, 4 * e)
		}
		setFromMatrix3Column(t, e) {
			return this.fromArray(t.elements, 3 * e)
		}
		equals(t) {
			return t.x === this.x && t.y === this.y && t.z === this.z
		}
		fromArray(t, e = 0) {
			return (this.x = t[e]), (this.y = t[e + 1]), (this.z = t[e + 2]), this
		}
		toArray(t = [], e = 0) {
			return (t[e] = this.x), (t[e + 1] = this.y), (t[e + 2] = this.z), t
		}
		fromBufferAttribute(t, e, s) {
			return (
				void 0 !== s && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),
				(this.x = t.getX(e)),
				(this.y = t.getY(e)),
				(this.z = t.getZ(e)),
				this
			)
		}
		random() {
			return (this.x = Math.random()), (this.y = Math.random()), (this.z = Math.random()), this
		}
	}
	Vector3.prototype.isVector3 = !0
	const h = new Vector3(),
		c = new Quaternion()
	class Matrix4 {
		constructor() {
			;(this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
				arguments.length > 0 &&
					console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")
		}
		set(t, e, s, i, r, n, o, a, h, c, l, u, d, m, p, y) {
			const b = this.elements
			return (
				(b[0] = t),
				(b[4] = e),
				(b[8] = s),
				(b[12] = i),
				(b[1] = r),
				(b[5] = n),
				(b[9] = o),
				(b[13] = a),
				(b[2] = h),
				(b[6] = c),
				(b[10] = l),
				(b[14] = u),
				(b[3] = d),
				(b[7] = m),
				(b[11] = p),
				(b[15] = y),
				this
			)
		}
		identity() {
			return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this
		}
		clone() {
			return new Matrix4().fromArray(this.elements)
		}
		copy(t) {
			const e = this.elements,
				s = t.elements
			return (
				(e[0] = s[0]),
				(e[1] = s[1]),
				(e[2] = s[2]),
				(e[3] = s[3]),
				(e[4] = s[4]),
				(e[5] = s[5]),
				(e[6] = s[6]),
				(e[7] = s[7]),
				(e[8] = s[8]),
				(e[9] = s[9]),
				(e[10] = s[10]),
				(e[11] = s[11]),
				(e[12] = s[12]),
				(e[13] = s[13]),
				(e[14] = s[14]),
				(e[15] = s[15]),
				this
			)
		}
		copyPosition(t) {
			const e = this.elements,
				s = t.elements
			return (e[12] = s[12]), (e[13] = s[13]), (e[14] = s[14]), this
		}
		setFromMatrix3(t) {
			const e = t.elements
			return this.set(e[0], e[3], e[6], 0, e[1], e[4], e[7], 0, e[2], e[5], e[8], 0, 0, 0, 0, 1), this
		}
		extractBasis(t, e, s) {
			return t.setFromMatrixColumn(this, 0), e.setFromMatrixColumn(this, 1), s.setFromMatrixColumn(this, 2), this
		}
		makeBasis(t, e, s) {
			return this.set(t.x, e.x, s.x, 0, t.y, e.y, s.y, 0, t.z, e.z, s.z, 0, 0, 0, 0, 1), this
		}
		extractRotation(t) {
			const e = this.elements,
				s = t.elements,
				i = 1 / l.setFromMatrixColumn(t, 0).length(),
				r = 1 / l.setFromMatrixColumn(t, 1).length(),
				n = 1 / l.setFromMatrixColumn(t, 2).length()
			return (
				(e[0] = s[0] * i),
				(e[1] = s[1] * i),
				(e[2] = s[2] * i),
				(e[3] = 0),
				(e[4] = s[4] * r),
				(e[5] = s[5] * r),
				(e[6] = s[6] * r),
				(e[7] = 0),
				(e[8] = s[8] * n),
				(e[9] = s[9] * n),
				(e[10] = s[10] * n),
				(e[11] = 0),
				(e[12] = 0),
				(e[13] = 0),
				(e[14] = 0),
				(e[15] = 1),
				this
			)
		}
		makeRotationFromEuler(t) {
			;(t && t.isEuler) ||
				console.error(
					"THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."
				)
			const e = this.elements,
				s = t.x,
				i = t.y,
				r = t.z,
				n = Math.cos(s),
				o = Math.sin(s),
				a = Math.cos(i),
				h = Math.sin(i),
				c = Math.cos(r),
				l = Math.sin(r)
			if ("XYZ" === t.order) {
				const t = n * c,
					s = n * l,
					i = o * c,
					r = o * l
				;(e[0] = a * c),
					(e[4] = -a * l),
					(e[8] = h),
					(e[1] = s + i * h),
					(e[5] = t - r * h),
					(e[9] = -o * a),
					(e[2] = r - t * h),
					(e[6] = i + s * h),
					(e[10] = n * a)
			} else if ("YXZ" === t.order) {
				const t = a * c,
					s = a * l,
					i = h * c,
					r = h * l
				;(e[0] = t + r * o),
					(e[4] = i * o - s),
					(e[8] = n * h),
					(e[1] = n * l),
					(e[5] = n * c),
					(e[9] = -o),
					(e[2] = s * o - i),
					(e[6] = r + t * o),
					(e[10] = n * a)
			} else if ("ZXY" === t.order) {
				const t = a * c,
					s = a * l,
					i = h * c,
					r = h * l
				;(e[0] = t - r * o),
					(e[4] = -n * l),
					(e[8] = i + s * o),
					(e[1] = s + i * o),
					(e[5] = n * c),
					(e[9] = r - t * o),
					(e[2] = -n * h),
					(e[6] = o),
					(e[10] = n * a)
			} else if ("ZYX" === t.order) {
				const t = n * c,
					s = n * l,
					i = o * c,
					r = o * l
				;(e[0] = a * c),
					(e[4] = i * h - s),
					(e[8] = t * h + r),
					(e[1] = a * l),
					(e[5] = r * h + t),
					(e[9] = s * h - i),
					(e[2] = -h),
					(e[6] = o * a),
					(e[10] = n * a)
			} else if ("YZX" === t.order) {
				const t = n * a,
					s = n * h,
					i = o * a,
					r = o * h
				;(e[0] = a * c),
					(e[4] = r - t * l),
					(e[8] = i * l + s),
					(e[1] = l),
					(e[5] = n * c),
					(e[9] = -o * c),
					(e[2] = -h * c),
					(e[6] = s * l + i),
					(e[10] = t - r * l)
			} else if ("XZY" === t.order) {
				const t = n * a,
					s = n * h,
					i = o * a,
					r = o * h
				;(e[0] = a * c),
					(e[4] = -l),
					(e[8] = h * c),
					(e[1] = t * l + r),
					(e[5] = n * c),
					(e[9] = s * l - i),
					(e[2] = i * l - s),
					(e[6] = o * c),
					(e[10] = r * l + t)
			}
			return (e[3] = 0), (e[7] = 0), (e[11] = 0), (e[12] = 0), (e[13] = 0), (e[14] = 0), (e[15] = 1), this
		}
		makeRotationFromQuaternion(t) {
			return this.compose(d, t, m)
		}
		lookAt(t, e, s) {
			const i = this.elements
			return (
				b.subVectors(t, e),
				0 === b.lengthSq() && (b.z = 1),
				b.normalize(),
				p.crossVectors(s, b),
				0 === p.lengthSq() &&
					(1 === Math.abs(s.z) ? (b.x += 1e-4) : (b.z += 1e-4), b.normalize(), p.crossVectors(s, b)),
				p.normalize(),
				y.crossVectors(b, p),
				(i[0] = p.x),
				(i[4] = y.x),
				(i[8] = b.x),
				(i[1] = p.y),
				(i[5] = y.y),
				(i[9] = b.y),
				(i[2] = p.z),
				(i[6] = y.z),
				(i[10] = b.z),
				this
			)
		}
		multiply(t, e) {
			return void 0 !== e
				? (console.warn(
						"THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."
				  ),
				  this.multiplyMatrices(t, e))
				: this.multiplyMatrices(this, t)
		}
		premultiply(t) {
			return this.multiplyMatrices(t, this)
		}
		multiplyMatrices(t, e) {
			const s = t.elements,
				i = e.elements,
				r = this.elements,
				n = s[0],
				o = s[4],
				a = s[8],
				h = s[12],
				c = s[1],
				l = s[5],
				u = s[9],
				d = s[13],
				m = s[2],
				p = s[6],
				y = s[10],
				b = s[14],
				g = s[3],
				x = s[7],
				v = s[11],
				f = s[15],
				_ = i[0],
				M = i[4],
				E = i[8],
				w = i[12],
				C = i[1],
				O = i[5],
				z = i[9],
				R = i[13],
				A = i[2],
				S = i[6],
				T = i[10],
				I = i[14],
				N = i[3],
				D = i[7],
				k = i[11],
				P = i[15]
			return (
				(r[0] = n * _ + o * C + a * A + h * N),
				(r[4] = n * M + o * O + a * S + h * D),
				(r[8] = n * E + o * z + a * T + h * k),
				(r[12] = n * w + o * R + a * I + h * P),
				(r[1] = c * _ + l * C + u * A + d * N),
				(r[5] = c * M + l * O + u * S + d * D),
				(r[9] = c * E + l * z + u * T + d * k),
				(r[13] = c * w + l * R + u * I + d * P),
				(r[2] = m * _ + p * C + y * A + b * N),
				(r[6] = m * M + p * O + y * S + b * D),
				(r[10] = m * E + p * z + y * T + b * k),
				(r[14] = m * w + p * R + y * I + b * P),
				(r[3] = g * _ + x * C + v * A + f * N),
				(r[7] = g * M + x * O + v * S + f * D),
				(r[11] = g * E + x * z + v * T + f * k),
				(r[15] = g * w + x * R + v * I + f * P),
				this
			)
		}
		multiplyScalar(t) {
			const e = this.elements
			return (
				(e[0] *= t),
				(e[4] *= t),
				(e[8] *= t),
				(e[12] *= t),
				(e[1] *= t),
				(e[5] *= t),
				(e[9] *= t),
				(e[13] *= t),
				(e[2] *= t),
				(e[6] *= t),
				(e[10] *= t),
				(e[14] *= t),
				(e[3] *= t),
				(e[7] *= t),
				(e[11] *= t),
				(e[15] *= t),
				this
			)
		}
		determinant() {
			const t = this.elements,
				e = t[0],
				s = t[4],
				i = t[8],
				r = t[12],
				n = t[1],
				o = t[5],
				a = t[9],
				h = t[13],
				c = t[2],
				l = t[6],
				u = t[10],
				d = t[14]
			return (
				t[3] * (+r * a * l - i * h * l - r * o * u + s * h * u + i * o * d - s * a * d) +
				t[7] * (+e * a * d - e * h * u + r * n * u - i * n * d + i * h * c - r * a * c) +
				t[11] * (+e * h * l - e * o * d - r * n * l + s * n * d + r * o * c - s * h * c) +
				t[15] * (-i * o * c - e * a * l + e * o * u + i * n * l - s * n * u + s * a * c)
			)
		}
		transpose() {
			const t = this.elements
			let e
			return (
				(e = t[1]),
				(t[1] = t[4]),
				(t[4] = e),
				(e = t[2]),
				(t[2] = t[8]),
				(t[8] = e),
				(e = t[6]),
				(t[6] = t[9]),
				(t[9] = e),
				(e = t[3]),
				(t[3] = t[12]),
				(t[12] = e),
				(e = t[7]),
				(t[7] = t[13]),
				(t[13] = e),
				(e = t[11]),
				(t[11] = t[14]),
				(t[14] = e),
				this
			)
		}
		setPosition(t, e, s) {
			const i = this.elements
			return t.isVector3 ? ((i[12] = t.x), (i[13] = t.y), (i[14] = t.z)) : ((i[12] = t), (i[13] = e), (i[14] = s)), this
		}
		invert() {
			const t = this.elements,
				e = t[0],
				s = t[1],
				i = t[2],
				r = t[3],
				n = t[4],
				o = t[5],
				a = t[6],
				h = t[7],
				c = t[8],
				l = t[9],
				u = t[10],
				d = t[11],
				m = t[12],
				p = t[13],
				y = t[14],
				b = t[15],
				g = l * y * h - p * u * h + p * a * d - o * y * d - l * a * b + o * u * b,
				x = m * u * h - c * y * h - m * a * d + n * y * d + c * a * b - n * u * b,
				v = c * p * h - m * l * h + m * o * d - n * p * d - c * o * b + n * l * b,
				f = m * l * a - c * p * a - m * o * u + n * p * u + c * o * y - n * l * y,
				_ = e * g + s * x + i * v + r * f
			if (0 === _) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
			const M = 1 / _
			return (
				(t[0] = g * M),
				(t[1] = (p * u * r - l * y * r - p * i * d + s * y * d + l * i * b - s * u * b) * M),
				(t[2] = (o * y * r - p * a * r + p * i * h - s * y * h - o * i * b + s * a * b) * M),
				(t[3] = (l * a * r - o * u * r - l * i * h + s * u * h + o * i * d - s * a * d) * M),
				(t[4] = x * M),
				(t[5] = (c * y * r - m * u * r + m * i * d - e * y * d - c * i * b + e * u * b) * M),
				(t[6] = (m * a * r - n * y * r - m * i * h + e * y * h + n * i * b - e * a * b) * M),
				(t[7] = (n * u * r - c * a * r + c * i * h - e * u * h - n * i * d + e * a * d) * M),
				(t[8] = v * M),
				(t[9] = (m * l * r - c * p * r - m * s * d + e * p * d + c * s * b - e * l * b) * M),
				(t[10] = (n * p * r - m * o * r + m * s * h - e * p * h - n * s * b + e * o * b) * M),
				(t[11] = (c * o * r - n * l * r - c * s * h + e * l * h + n * s * d - e * o * d) * M),
				(t[12] = f * M),
				(t[13] = (c * p * i - m * l * i + m * s * u - e * p * u - c * s * y + e * l * y) * M),
				(t[14] = (m * o * i - n * p * i - m * s * a + e * p * a + n * s * y - e * o * y) * M),
				(t[15] = (n * l * i - c * o * i + c * s * a - e * l * a - n * s * u + e * o * u) * M),
				this
			)
		}
		scale(t) {
			const e = this.elements,
				s = t.x,
				i = t.y,
				r = t.z
			return (
				(e[0] *= s),
				(e[4] *= i),
				(e[8] *= r),
				(e[1] *= s),
				(e[5] *= i),
				(e[9] *= r),
				(e[2] *= s),
				(e[6] *= i),
				(e[10] *= r),
				(e[3] *= s),
				(e[7] *= i),
				(e[11] *= r),
				this
			)
		}
		getMaxScaleOnAxis() {
			const t = this.elements,
				e = t[0] * t[0] + t[1] * t[1] + t[2] * t[2],
				s = t[4] * t[4] + t[5] * t[5] + t[6] * t[6],
				i = t[8] * t[8] + t[9] * t[9] + t[10] * t[10]
			return Math.sqrt(Math.max(e, s, i))
		}
		makeTranslation(t, e, s) {
			return this.set(1, 0, 0, t, 0, 1, 0, e, 0, 0, 1, s, 0, 0, 0, 1), this
		}
		makeRotationX(t) {
			const e = Math.cos(t),
				s = Math.sin(t)
			return this.set(1, 0, 0, 0, 0, e, -s, 0, 0, s, e, 0, 0, 0, 0, 1), this
		}
		makeRotationY(t) {
			const e = Math.cos(t),
				s = Math.sin(t)
			return this.set(e, 0, s, 0, 0, 1, 0, 0, -s, 0, e, 0, 0, 0, 0, 1), this
		}
		makeRotationZ(t) {
			const e = Math.cos(t),
				s = Math.sin(t)
			return this.set(e, -s, 0, 0, s, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this
		}
		makeRotationAxis(t, e) {
			const s = Math.cos(e),
				i = Math.sin(e),
				r = 1 - s,
				n = t.x,
				o = t.y,
				a = t.z,
				h = r * n,
				c = r * o
			return (
				this.set(
					h * n + s,
					h * o - i * a,
					h * a + i * o,
					0,
					h * o + i * a,
					c * o + s,
					c * a - i * n,
					0,
					h * a - i * o,
					c * a + i * n,
					r * a * a + s,
					0,
					0,
					0,
					0,
					1
				),
				this
			)
		}
		makeScale(t, e, s) {
			return this.set(t, 0, 0, 0, 0, e, 0, 0, 0, 0, s, 0, 0, 0, 0, 1), this
		}
		makeShear(t, e, s) {
			return this.set(1, e, s, 0, t, 1, s, 0, t, e, 1, 0, 0, 0, 0, 1), this
		}
		compose(t, e, s) {
			const i = this.elements,
				r = e._x,
				n = e._y,
				o = e._z,
				a = e._w,
				h = r + r,
				c = n + n,
				l = o + o,
				u = r * h,
				d = r * c,
				m = r * l,
				p = n * c,
				y = n * l,
				b = o * l,
				g = a * h,
				x = a * c,
				v = a * l,
				f = s.x,
				_ = s.y,
				M = s.z
			return (
				(i[0] = (1 - (p + b)) * f),
				(i[1] = (d + v) * f),
				(i[2] = (m - x) * f),
				(i[3] = 0),
				(i[4] = (d - v) * _),
				(i[5] = (1 - (u + b)) * _),
				(i[6] = (y + g) * _),
				(i[7] = 0),
				(i[8] = (m + x) * M),
				(i[9] = (y - g) * M),
				(i[10] = (1 - (u + p)) * M),
				(i[11] = 0),
				(i[12] = t.x),
				(i[13] = t.y),
				(i[14] = t.z),
				(i[15] = 1),
				this
			)
		}
		decompose(t, e, s) {
			const i = this.elements
			let r = l.set(i[0], i[1], i[2]).length()
			const n = l.set(i[4], i[5], i[6]).length(),
				o = l.set(i[8], i[9], i[10]).length()
			this.determinant() < 0 && (r = -r), (t.x = i[12]), (t.y = i[13]), (t.z = i[14]), u.copy(this)
			const a = 1 / r,
				h = 1 / n,
				c = 1 / o
			return (
				(u.elements[0] *= a),
				(u.elements[1] *= a),
				(u.elements[2] *= a),
				(u.elements[4] *= h),
				(u.elements[5] *= h),
				(u.elements[6] *= h),
				(u.elements[8] *= c),
				(u.elements[9] *= c),
				(u.elements[10] *= c),
				e.setFromRotationMatrix(u),
				(s.x = r),
				(s.y = n),
				(s.z = o),
				this
			)
		}
		makePerspective(t, e, s, i, r, n) {
			void 0 === n &&
				console.warn(
					"THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."
				)
			const o = this.elements,
				a = (2 * r) / (e - t),
				h = (2 * r) / (s - i),
				c = (e + t) / (e - t),
				l = (s + i) / (s - i),
				u = -(n + r) / (n - r),
				d = (-2 * n * r) / (n - r)
			return (
				(o[0] = a),
				(o[4] = 0),
				(o[8] = c),
				(o[12] = 0),
				(o[1] = 0),
				(o[5] = h),
				(o[9] = l),
				(o[13] = 0),
				(o[2] = 0),
				(o[6] = 0),
				(o[10] = u),
				(o[14] = d),
				(o[3] = 0),
				(o[7] = 0),
				(o[11] = -1),
				(o[15] = 0),
				this
			)
		}
		makeOrthographic(t, e, s, i, r, n) {
			const o = this.elements,
				a = 1 / (e - t),
				h = 1 / (s - i),
				c = 1 / (n - r),
				l = (e + t) * a,
				u = (s + i) * h,
				d = (n + r) * c
			return (
				(o[0] = 2 * a),
				(o[4] = 0),
				(o[8] = 0),
				(o[12] = -l),
				(o[1] = 0),
				(o[5] = 2 * h),
				(o[9] = 0),
				(o[13] = -u),
				(o[2] = 0),
				(o[6] = 0),
				(o[10] = -2 * c),
				(o[14] = -d),
				(o[3] = 0),
				(o[7] = 0),
				(o[11] = 0),
				(o[15] = 1),
				this
			)
		}
		equals(t) {
			const e = this.elements,
				s = t.elements
			for (let t = 0; t < 16; t++) if (e[t] !== s[t]) return !1
			return !0
		}
		fromArray(t, e = 0) {
			for (let s = 0; s < 16; s++) this.elements[s] = t[s + e]
			return this
		}
		toArray(t = [], e = 0) {
			const s = this.elements
			return (
				(t[e] = s[0]),
				(t[e + 1] = s[1]),
				(t[e + 2] = s[2]),
				(t[e + 3] = s[3]),
				(t[e + 4] = s[4]),
				(t[e + 5] = s[5]),
				(t[e + 6] = s[6]),
				(t[e + 7] = s[7]),
				(t[e + 8] = s[8]),
				(t[e + 9] = s[9]),
				(t[e + 10] = s[10]),
				(t[e + 11] = s[11]),
				(t[e + 12] = s[12]),
				(t[e + 13] = s[13]),
				(t[e + 14] = s[14]),
				(t[e + 15] = s[15]),
				t
			)
		}
	}
	Matrix4.prototype.isMatrix4 = !0
	const l = new Vector3(),
		u = new Matrix4(),
		d = new Vector3(0, 0, 0),
		m = new Vector3(1, 1, 1),
		p = new Vector3(),
		y = new Vector3(),
		b = new Vector3(),
		g = new Matrix4(),
		x = new Quaternion()
	class Euler {
		constructor(t = 0, e = 0, s = 0, i = Euler.DefaultOrder) {
			;(this._x = t), (this._y = e), (this._z = s), (this._order = i)
		}
		get x() {
			return this._x
		}
		set x(t) {
			;(this._x = t), this._onChangeCallback()
		}
		get y() {
			return this._y
		}
		set y(t) {
			;(this._y = t), this._onChangeCallback()
		}
		get z() {
			return this._z
		}
		set z(t) {
			;(this._z = t), this._onChangeCallback()
		}
		get order() {
			return this._order
		}
		set order(t) {
			;(this._order = t), this._onChangeCallback()
		}
		set(t, e, s, i) {
			return (
				(this._x = t), (this._y = e), (this._z = s), (this._order = i || this._order), this._onChangeCallback(), this
			)
		}
		clone() {
			return new this.constructor(this._x, this._y, this._z, this._order)
		}
		copy(t) {
			return (
				(this._x = t._x), (this._y = t._y), (this._z = t._z), (this._order = t._order), this._onChangeCallback(), this
			)
		}
		setFromRotationMatrix(t, e, s) {
			const i = t.elements,
				r = i[0],
				n = i[4],
				o = i[8],
				h = i[1],
				c = i[5],
				l = i[9],
				u = i[2],
				d = i[6],
				m = i[10]
			switch ((e = e || this._order)) {
				case "XYZ":
					;(this._y = Math.asin(a(o, -1, 1))),
						Math.abs(o) < 0.9999999
							? ((this._x = Math.atan2(-l, m)), (this._z = Math.atan2(-n, r)))
							: ((this._x = Math.atan2(d, c)), (this._z = 0))
					break
				case "YXZ":
					;(this._x = Math.asin(-a(l, -1, 1))),
						Math.abs(l) < 0.9999999
							? ((this._y = Math.atan2(o, m)), (this._z = Math.atan2(h, c)))
							: ((this._y = Math.atan2(-u, r)), (this._z = 0))
					break
				case "ZXY":
					;(this._x = Math.asin(a(d, -1, 1))),
						Math.abs(d) < 0.9999999
							? ((this._y = Math.atan2(-u, m)), (this._z = Math.atan2(-n, c)))
							: ((this._y = 0), (this._z = Math.atan2(h, r)))
					break
				case "ZYX":
					;(this._y = Math.asin(-a(u, -1, 1))),
						Math.abs(u) < 0.9999999
							? ((this._x = Math.atan2(d, m)), (this._z = Math.atan2(h, r)))
							: ((this._x = 0), (this._z = Math.atan2(-n, c)))
					break
				case "YZX":
					;(this._z = Math.asin(a(h, -1, 1))),
						Math.abs(h) < 0.9999999
							? ((this._x = Math.atan2(-l, c)), (this._y = Math.atan2(-u, r)))
							: ((this._x = 0), (this._y = Math.atan2(o, m)))
					break
				case "XZY":
					;(this._z = Math.asin(-a(n, -1, 1))),
						Math.abs(n) < 0.9999999
							? ((this._x = Math.atan2(d, c)), (this._y = Math.atan2(o, r)))
							: ((this._x = Math.atan2(-l, m)), (this._y = 0))
					break
				default:
					console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + e)
			}
			return (this._order = e), !1 !== s && this._onChangeCallback(), this
		}
		setFromQuaternion(t, e, s) {
			return g.makeRotationFromQuaternion(t), this.setFromRotationMatrix(g, e, s)
		}
		setFromVector3(t, e) {
			return this.set(t.x, t.y, t.z, e || this._order)
		}
		reorder(t) {
			return x.setFromEuler(this), this.setFromQuaternion(x, t)
		}
		equals(t) {
			return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order
		}
		fromArray(t) {
			return (
				(this._x = t[0]),
				(this._y = t[1]),
				(this._z = t[2]),
				void 0 !== t[3] && (this._order = t[3]),
				this._onChangeCallback(),
				this
			)
		}
		toArray(t = [], e = 0) {
			return (t[e] = this._x), (t[e + 1] = this._y), (t[e + 2] = this._z), (t[e + 3] = this._order), t
		}
		toVector3(t) {
			return t ? t.set(this._x, this._y, this._z) : new Vector3(this._x, this._y, this._z)
		}
		_onChange(t) {
			return (this._onChangeCallback = t), this
		}
		_onChangeCallback() {}
	}
	;(Euler.prototype.isEuler = !0),
		(Euler.DefaultOrder = "XYZ"),
		(Euler.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"])
	class Layers {
		constructor() {
			this.mask = 1
		}
		set(t) {
			this.mask = (1 << t) | 0
		}
		enable(t) {
			this.mask |= (1 << t) | 0
		}
		enableAll() {
			this.mask = -1
		}
		toggle(t) {
			this.mask ^= (1 << t) | 0
		}
		disable(t) {
			this.mask &= ~((1 << t) | 0)
		}
		disableAll() {
			this.mask = 0
		}
		test(t) {
			return 0 != (this.mask & t.mask)
		}
	}
	class Matrix3 {
		constructor() {
			;(this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]),
				arguments.length > 0 &&
					console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")
		}
		set(t, e, s, i, r, n, o, a, h) {
			const c = this.elements
			return (
				(c[0] = t), (c[1] = i), (c[2] = o), (c[3] = e), (c[4] = r), (c[5] = a), (c[6] = s), (c[7] = n), (c[8] = h), this
			)
		}
		identity() {
			return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this
		}
		copy(t) {
			const e = this.elements,
				s = t.elements
			return (
				(e[0] = s[0]),
				(e[1] = s[1]),
				(e[2] = s[2]),
				(e[3] = s[3]),
				(e[4] = s[4]),
				(e[5] = s[5]),
				(e[6] = s[6]),
				(e[7] = s[7]),
				(e[8] = s[8]),
				this
			)
		}
		extractBasis(t, e, s) {
			return t.setFromMatrix3Column(this, 0), e.setFromMatrix3Column(this, 1), s.setFromMatrix3Column(this, 2), this
		}
		setFromMatrix4(t) {
			const e = t.elements
			return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]), this
		}
		multiply(t) {
			return this.multiplyMatrices(this, t)
		}
		premultiply(t) {
			return this.multiplyMatrices(t, this)
		}
		multiplyMatrices(t, e) {
			const s = t.elements,
				i = e.elements,
				r = this.elements,
				n = s[0],
				o = s[3],
				a = s[6],
				h = s[1],
				c = s[4],
				l = s[7],
				u = s[2],
				d = s[5],
				m = s[8],
				p = i[0],
				y = i[3],
				b = i[6],
				g = i[1],
				x = i[4],
				v = i[7],
				f = i[2],
				_ = i[5],
				M = i[8]
			return (
				(r[0] = n * p + o * g + a * f),
				(r[3] = n * y + o * x + a * _),
				(r[6] = n * b + o * v + a * M),
				(r[1] = h * p + c * g + l * f),
				(r[4] = h * y + c * x + l * _),
				(r[7] = h * b + c * v + l * M),
				(r[2] = u * p + d * g + m * f),
				(r[5] = u * y + d * x + m * _),
				(r[8] = u * b + d * v + m * M),
				this
			)
		}
		multiplyScalar(t) {
			const e = this.elements
			return (
				(e[0] *= t),
				(e[3] *= t),
				(e[6] *= t),
				(e[1] *= t),
				(e[4] *= t),
				(e[7] *= t),
				(e[2] *= t),
				(e[5] *= t),
				(e[8] *= t),
				this
			)
		}
		determinant() {
			const t = this.elements,
				e = t[0],
				s = t[1],
				i = t[2],
				r = t[3],
				n = t[4],
				o = t[5],
				a = t[6],
				h = t[7],
				c = t[8]
			return e * n * c - e * o * h - s * r * c + s * o * a + i * r * h - i * n * a
		}
		invert() {
			const t = this.elements,
				e = t[0],
				s = t[1],
				i = t[2],
				r = t[3],
				n = t[4],
				o = t[5],
				a = t[6],
				h = t[7],
				c = t[8],
				l = c * n - o * h,
				u = o * a - c * r,
				d = h * r - n * a,
				m = e * l + s * u + i * d
			if (0 === m) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0)
			const p = 1 / m
			return (
				(t[0] = l * p),
				(t[1] = (i * h - c * s) * p),
				(t[2] = (o * s - i * n) * p),
				(t[3] = u * p),
				(t[4] = (c * e - i * a) * p),
				(t[5] = (i * r - o * e) * p),
				(t[6] = d * p),
				(t[7] = (s * a - h * e) * p),
				(t[8] = (n * e - s * r) * p),
				this
			)
		}
		transpose() {
			let t
			const e = this.elements
			return (
				(t = e[1]),
				(e[1] = e[3]),
				(e[3] = t),
				(t = e[2]),
				(e[2] = e[6]),
				(e[6] = t),
				(t = e[5]),
				(e[5] = e[7]),
				(e[7] = t),
				this
			)
		}
		getNormalMatrix(t) {
			return this.setFromMatrix4(t).invert().transpose()
		}
		transposeIntoArray(t) {
			const e = this.elements
			return (
				(t[0] = e[0]),
				(t[1] = e[3]),
				(t[2] = e[6]),
				(t[3] = e[1]),
				(t[4] = e[4]),
				(t[5] = e[7]),
				(t[6] = e[2]),
				(t[7] = e[5]),
				(t[8] = e[8]),
				this
			)
		}
		setUvTransform(t, e, s, i, r, n, o) {
			const a = Math.cos(r),
				h = Math.sin(r)
			return (
				this.set(s * a, s * h, -s * (a * n + h * o) + n + t, -i * h, i * a, -i * (-h * n + a * o) + o + e, 0, 0, 1),
				this
			)
		}
		scale(t, e) {
			const s = this.elements
			return (s[0] *= t), (s[3] *= t), (s[6] *= t), (s[1] *= e), (s[4] *= e), (s[7] *= e), this
		}
		rotate(t) {
			const e = Math.cos(t),
				s = Math.sin(t),
				i = this.elements,
				r = i[0],
				n = i[3],
				o = i[6],
				a = i[1],
				h = i[4],
				c = i[7]
			return (
				(i[0] = e * r + s * a),
				(i[3] = e * n + s * h),
				(i[6] = e * o + s * c),
				(i[1] = -s * r + e * a),
				(i[4] = -s * n + e * h),
				(i[7] = -s * o + e * c),
				this
			)
		}
		translate(t, e) {
			const s = this.elements
			return (
				(s[0] += t * s[2]),
				(s[3] += t * s[5]),
				(s[6] += t * s[8]),
				(s[1] += e * s[2]),
				(s[4] += e * s[5]),
				(s[7] += e * s[8]),
				this
			)
		}
		equals(t) {
			const e = this.elements,
				s = t.elements
			for (let t = 0; t < 9; t++) if (e[t] !== s[t]) return !1
			return !0
		}
		fromArray(t, e = 0) {
			for (let s = 0; s < 9; s++) this.elements[s] = t[s + e]
			return this
		}
		toArray(t = [], e = 0) {
			const s = this.elements
			return (
				(t[e] = s[0]),
				(t[e + 1] = s[1]),
				(t[e + 2] = s[2]),
				(t[e + 3] = s[3]),
				(t[e + 4] = s[4]),
				(t[e + 5] = s[5]),
				(t[e + 6] = s[6]),
				(t[e + 7] = s[7]),
				(t[e + 8] = s[8]),
				t
			)
		}
		clone() {
			return new this.constructor().fromArray(this.elements)
		}
	}
	Matrix3.prototype.isMatrix3 = !0
	let v = 0
	const f = new Vector3(),
		_ = new Quaternion(),
		M = new Matrix4(),
		E = new Vector3(),
		w = new Vector3(),
		C = new Vector3(),
		O = new Quaternion(),
		z = new Vector3(1, 0, 0),
		R = new Vector3(0, 1, 0),
		A = new Vector3(0, 0, 1),
		S = { type: "added" },
		T = { type: "removed" }
	class Object3D extends class EventDispatcher {
		addEventListener(t, e) {
			void 0 === this._listeners && (this._listeners = {})
			const s = this._listeners
			void 0 === s[t] && (s[t] = []), -1 === s[t].indexOf(e) && s[t].push(e)
		}
		hasEventListener(t, e) {
			if (void 0 === this._listeners) return !1
			const s = this._listeners
			return void 0 !== s[t] && -1 !== s[t].indexOf(e)
		}
		removeEventListener(t, e) {
			if (void 0 === this._listeners) return
			const s = this._listeners[t]
			if (void 0 !== s) {
				const t = s.indexOf(e)
				;-1 !== t && s.splice(t, 1)
			}
		}
		dispatchEvent(t) {
			if (void 0 === this._listeners) return
			const e = this._listeners[t.type]
			if (void 0 !== e) {
				t.target = this
				const s = e.slice(0)
				for (let e = 0, i = s.length; e < i; e++) s[e].call(this, t)
				t.target = null
			}
		}
	} {
		constructor() {
			super(),
				Object.defineProperty(this, "id", { value: v++ }),
				(this.uuid = (function () {
					const t = (4294967295 * Math.random()) | 0,
						e = (4294967295 * Math.random()) | 0,
						s = (4294967295 * Math.random()) | 0,
						i = (4294967295 * Math.random()) | 0
					return (
						o[255 & t] +
						o[(t >> 8) & 255] +
						o[(t >> 16) & 255] +
						o[(t >> 24) & 255] +
						"-" +
						o[255 & e] +
						o[(e >> 8) & 255] +
						"-" +
						o[((e >> 16) & 15) | 64] +
						o[(e >> 24) & 255] +
						"-" +
						o[(63 & s) | 128] +
						o[(s >> 8) & 255] +
						"-" +
						o[(s >> 16) & 255] +
						o[(s >> 24) & 255] +
						o[255 & i] +
						o[(i >> 8) & 255] +
						o[(i >> 16) & 255] +
						o[(i >> 24) & 255]
					).toUpperCase()
				})()),
				(this.name = ""),
				(this.type = "Object3D"),
				(this.parent = null),
				(this.children = []),
				(this.up = Object3D.DefaultUp.clone())
			const t = new Vector3(),
				e = new Euler(),
				s = new Quaternion(),
				i = new Vector3(1, 1, 1)
			e._onChange(function () {
				s.setFromEuler(e, !1)
			}),
				s._onChange(function () {
					e.setFromQuaternion(s, void 0, !1)
				}),
				Object.defineProperties(this, {
					position: { configurable: !0, enumerable: !0, value: t },
					rotation: { configurable: !0, enumerable: !0, value: e },
					quaternion: { configurable: !0, enumerable: !0, value: s },
					scale: { configurable: !0, enumerable: !0, value: i },
					modelViewMatrix: { value: new Matrix4() },
					normalMatrix: { value: new Matrix3() }
				}),
				(this.matrix = new Matrix4()),
				(this.matrixWorld = new Matrix4()),
				(this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate),
				(this.matrixWorldNeedsUpdate = !1),
				(this.layers = new Layers()),
				(this.visible = !0),
				(this.castShadow = !1),
				(this.receiveShadow = !1),
				(this.frustumCulled = !0),
				(this.renderOrder = 0),
				(this.animations = []),
				(this.userData = {})
		}
		onBeforeRender() {}
		onAfterRender() {}
		applyMatrix4(t) {
			this.matrixAutoUpdate && this.updateMatrix(),
				this.matrix.premultiply(t),
				this.matrix.decompose(this.position, this.quaternion, this.scale)
		}
		applyQuaternion(t) {
			return this.quaternion.premultiply(t), this
		}
		setRotationFromAxisAngle(t, e) {
			this.quaternion.setFromAxisAngle(t, e)
		}
		setRotationFromEuler(t) {
			this.quaternion.setFromEuler(t, !0)
		}
		setRotationFromMatrix(t) {
			this.quaternion.setFromRotationMatrix(t)
		}
		setRotationFromQuaternion(t) {
			this.quaternion.copy(t)
		}
		rotateOnAxis(t, e) {
			return _.setFromAxisAngle(t, e), this.quaternion.multiply(_), this
		}
		rotateOnWorldAxis(t, e) {
			return _.setFromAxisAngle(t, e), this.quaternion.premultiply(_), this
		}
		rotateX(t) {
			return this.rotateOnAxis(z, t)
		}
		rotateY(t) {
			return this.rotateOnAxis(R, t)
		}
		rotateZ(t) {
			return this.rotateOnAxis(A, t)
		}
		translateOnAxis(t, e) {
			return f.copy(t).applyQuaternion(this.quaternion), this.position.add(f.multiplyScalar(e)), this
		}
		translateX(t) {
			return this.translateOnAxis(z, t)
		}
		translateY(t) {
			return this.translateOnAxis(R, t)
		}
		translateZ(t) {
			return this.translateOnAxis(A, t)
		}
		localToWorld(t) {
			return t.applyMatrix4(this.matrixWorld)
		}
		worldToLocal(t) {
			return t.applyMatrix4(M.copy(this.matrixWorld).invert())
		}
		lookAt(t, e, s) {
			t.isVector3 ? E.copy(t) : E.set(t, e, s)
			const i = this.parent
			this.updateWorldMatrix(!0, !1),
				w.setFromMatrixPosition(this.matrixWorld),
				this.isCamera || this.isLight ? M.lookAt(w, E, this.up) : M.lookAt(E, w, this.up),
				this.quaternion.setFromRotationMatrix(M),
				i && (M.extractRotation(i.matrixWorld), _.setFromRotationMatrix(M), this.quaternion.premultiply(_.invert()))
		}
		add(t) {
			if (arguments.length > 1) {
				for (let t = 0; t < arguments.length; t++) this.add(arguments[t])
				return this
			}
			return t === this
				? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", t), this)
				: (t && t.isObject3D
						? (null !== t.parent && t.parent.remove(t), (t.parent = this), this.children.push(t), t.dispatchEvent(S))
						: console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", t),
				  this)
		}
		remove(t) {
			if (arguments.length > 1) {
				for (let t = 0; t < arguments.length; t++) this.remove(arguments[t])
				return this
			}
			const e = this.children.indexOf(t)
			return -1 !== e && ((t.parent = null), this.children.splice(e, 1), t.dispatchEvent(T)), this
		}
		clear() {
			for (let t = 0; t < this.children.length; t++) {
				const e = this.children[t]
				;(e.parent = null), e.dispatchEvent(T)
			}
			return (this.children.length = 0), this
		}
		attach(t) {
			return (
				this.updateWorldMatrix(!0, !1),
				M.copy(this.matrixWorld).invert(),
				null !== t.parent && (t.parent.updateWorldMatrix(!0, !1), M.multiply(t.parent.matrixWorld)),
				t.applyMatrix4(M),
				this.add(t),
				t.updateWorldMatrix(!1, !0),
				this
			)
		}
		getObjectById(t) {
			return this.getObjectByProperty("id", t)
		}
		getObjectByName(t) {
			return this.getObjectByProperty("name", t)
		}
		getObjectByProperty(t, e) {
			if (this[t] === e) return this
			for (let s = 0, i = this.children.length; s < i; s++) {
				const i = this.children[s].getObjectByProperty(t, e)
				if (void 0 !== i) return i
			}
		}
		getWorldPosition(t) {
			return (
				void 0 === t &&
					(console.warn("THREE.Object3D: .getWorldPosition() target is now required"), (t = new Vector3())),
				this.updateWorldMatrix(!0, !1),
				t.setFromMatrixPosition(this.matrixWorld)
			)
		}
		getWorldQuaternion(t) {
			return (
				void 0 === t &&
					(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"), (t = new Quaternion())),
				this.updateWorldMatrix(!0, !1),
				this.matrixWorld.decompose(w, t, C),
				t
			)
		}
		getWorldScale(t) {
			return (
				void 0 === t && (console.warn("THREE.Object3D: .getWorldScale() target is now required"), (t = new Vector3())),
				this.updateWorldMatrix(!0, !1),
				this.matrixWorld.decompose(w, O, t),
				t
			)
		}
		getWorldDirection(t) {
			void 0 === t &&
				(console.warn("THREE.Object3D: .getWorldDirection() target is now required"), (t = new Vector3())),
				this.updateWorldMatrix(!0, !1)
			const e = this.matrixWorld.elements
			return t.set(e[8], e[9], e[10]).normalize()
		}
		raycast() {}
		traverse(t) {
			t(this)
			const e = this.children
			for (let s = 0, i = e.length; s < i; s++) e[s].traverse(t)
		}
		traverseVisible(t) {
			if (!1 === this.visible) return
			t(this)
			const e = this.children
			for (let s = 0, i = e.length; s < i; s++) e[s].traverseVisible(t)
		}
		traverseAncestors(t) {
			const e = this.parent
			null !== e && (t(e), e.traverseAncestors(t))
		}
		updateMatrix() {
			this.matrix.compose(this.position, this.quaternion, this.scale), (this.matrixWorldNeedsUpdate = !0)
		}
		updateMatrixWorld(t) {
			this.matrixAutoUpdate && this.updateMatrix(),
				(this.matrixWorldNeedsUpdate || t) &&
					(null === this.parent
						? this.matrixWorld.copy(this.matrix)
						: this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
					(this.matrixWorldNeedsUpdate = !1),
					(t = !0))
			const e = this.children
			for (let s = 0, i = e.length; s < i; s++) e[s].updateMatrixWorld(t)
		}
		updateWorldMatrix(t, e) {
			const s = this.parent
			if (
				(!0 === t && null !== s && s.updateWorldMatrix(!0, !1),
				this.matrixAutoUpdate && this.updateMatrix(),
				null === this.parent
					? this.matrixWorld.copy(this.matrix)
					: this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
				!0 === e)
			) {
				const t = this.children
				for (let e = 0, s = t.length; e < s; e++) t[e].updateWorldMatrix(!1, !0)
			}
		}
		toJSON(t) {
			const e = void 0 === t || "string" == typeof t,
				s = {}
			e &&
				((t = { geometries: {}, materials: {}, textures: {}, images: {}, shapes: {}, skeletons: {}, animations: {} }),
				(s.metadata = { version: 4.5, type: "Object", generator: "Object3D.toJSON" }))
			const i = {}
			function r(e, s) {
				return void 0 === e[s.uuid] && (e[s.uuid] = s.toJSON(t)), s.uuid
			}
			if (
				((i.uuid = this.uuid),
				(i.type = this.type),
				"" !== this.name && (i.name = this.name),
				!0 === this.castShadow && (i.castShadow = !0),
				!0 === this.receiveShadow && (i.receiveShadow = !0),
				!1 === this.visible && (i.visible = !1),
				!1 === this.frustumCulled && (i.frustumCulled = !1),
				0 !== this.renderOrder && (i.renderOrder = this.renderOrder),
				"{}" !== JSON.stringify(this.userData) && (i.userData = this.userData),
				(i.layers = this.layers.mask),
				(i.matrix = this.matrix.toArray()),
				!1 === this.matrixAutoUpdate && (i.matrixAutoUpdate = !1),
				this.isInstancedMesh &&
					((i.type = "InstancedMesh"),
					(i.count = this.count),
					(i.instanceMatrix = this.instanceMatrix.toJSON()),
					null !== this.instanceColor && (i.instanceColor = this.instanceColor.toJSON())),
				this.isMesh || this.isLine || this.isPoints)
			) {
				i.geometry = r(t.geometries, this.geometry)
				const e = this.geometry.parameters
				if (void 0 !== e && void 0 !== e.shapes) {
					const s = e.shapes
					if (Array.isArray(s))
						for (let e = 0, i = s.length; e < i; e++) {
							const i = s[e]
							r(t.shapes, i)
						}
					else r(t.shapes, s)
				}
			}
			if (
				(this.isSkinnedMesh &&
					((i.bindMode = this.bindMode),
					(i.bindMatrix = this.bindMatrix.toArray()),
					void 0 !== this.skeleton && (r(t.skeletons, this.skeleton), (i.skeleton = this.skeleton.uuid))),
				void 0 !== this.material)
			)
				if (Array.isArray(this.material)) {
					const e = []
					for (let s = 0, i = this.material.length; s < i; s++) e.push(r(t.materials, this.material[s]))
					i.material = e
				} else i.material = r(t.materials, this.material)
			if (this.children.length > 0) {
				i.children = []
				for (let e = 0; e < this.children.length; e++) i.children.push(this.children[e].toJSON(t).object)
			}
			if (this.animations.length > 0) {
				i.animations = []
				for (let e = 0; e < this.animations.length; e++) {
					const s = this.animations[e]
					i.animations.push(r(t.animations, s))
				}
			}
			if (e) {
				const e = n(t.geometries),
					i = n(t.materials),
					r = n(t.textures),
					o = n(t.images),
					a = n(t.shapes),
					h = n(t.skeletons),
					c = n(t.animations)
				e.length > 0 && (s.geometries = e),
					i.length > 0 && (s.materials = i),
					r.length > 0 && (s.textures = r),
					o.length > 0 && (s.images = o),
					a.length > 0 && (s.shapes = a),
					h.length > 0 && (s.skeletons = h),
					c.length > 0 && (s.animations = c)
			}
			return (s.object = i), s
			function n(t) {
				const e = []
				for (const s in t) {
					const i = t[s]
					delete i.metadata, e.push(i)
				}
				return e
			}
		}
		clone(t) {
			return new this.constructor().copy(this, t)
		}
		copy(t, e = !0) {
			if (
				((this.name = t.name),
				this.up.copy(t.up),
				this.position.copy(t.position),
				(this.rotation.order = t.rotation.order),
				this.quaternion.copy(t.quaternion),
				this.scale.copy(t.scale),
				this.matrix.copy(t.matrix),
				this.matrixWorld.copy(t.matrixWorld),
				(this.matrixAutoUpdate = t.matrixAutoUpdate),
				(this.matrixWorldNeedsUpdate = t.matrixWorldNeedsUpdate),
				(this.layers.mask = t.layers.mask),
				(this.visible = t.visible),
				(this.castShadow = t.castShadow),
				(this.receiveShadow = t.receiveShadow),
				(this.frustumCulled = t.frustumCulled),
				(this.renderOrder = t.renderOrder),
				(this.userData = JSON.parse(JSON.stringify(t.userData))),
				!0 === e)
			)
				for (let e = 0; e < t.children.length; e++) {
					const s = t.children[e]
					this.add(s.clone())
				}
			return this
		}
	}
	;(Object3D.DefaultUp = new Vector3(0, 1, 0)),
		(Object3D.DefaultMatrixAutoUpdate = !0),
		(Object3D.prototype.isObject3D = !0)
	class Camera extends Object3D {
		constructor() {
			super(),
				(this.type = "Camera"),
				(this.matrixWorldInverse = new Matrix4()),
				(this.projectionMatrix = new Matrix4()),
				(this.projectionMatrixInverse = new Matrix4())
		}
		copy(t, e) {
			return (
				super.copy(t, e),
				this.matrixWorldInverse.copy(t.matrixWorldInverse),
				this.projectionMatrix.copy(t.projectionMatrix),
				this.projectionMatrixInverse.copy(t.projectionMatrixInverse),
				this
			)
		}
		getWorldDirection(t) {
			void 0 === t && (console.warn("THREE.Camera: .getWorldDirection() target is now required"), (t = new Vector3())),
				this.updateWorldMatrix(!0, !1)
			const e = this.matrixWorld.elements
			return t.set(-e[8], -e[9], -e[10]).normalize()
		}
		updateMatrixWorld(t) {
			super.updateMatrixWorld(t), this.matrixWorldInverse.copy(this.matrixWorld).invert()
		}
		updateWorldMatrix(t, e) {
			super.updateWorldMatrix(t, e), this.matrixWorldInverse.copy(this.matrixWorld).invert()
		}
		clone() {
			return new this.constructor().copy(this)
		}
	}
	Camera.prototype.isCamera = !0
	const I = (t, e, s = 1e-5) => Math.abs(t - e) <= s,
		N = (t, e, s = 1e-5) => I(t.x, e.x, s) && I(t.y, e.y, s),
		D = (t, e, s = 1e-5) => N(t, e, s) && I(t.z, e.z, s)
	function k(t, e) {
		;(t.x = e.x), (t.y = e.y)
	}
	function P(t, e) {
		k(t, e), (t.z = e.z)
	}
	class BaseException extends Error {
		constructor(t, e) {
			var s
			super(t instanceof Error ? t.message : t),
				(this.name = "BaseException"),
				e && (this.code = e),
				t instanceof Error &&
					((this.originalError = t), (s = t) && s instanceof Error && s.isMock && (this.isMock = !0))
		}
	}
	class ArraySizeMismatchException extends BaseException {
		constructor() {
			super("Cannot copy into an array of a different size"), (this.name = "ArraySizeMismatch")
		}
	}
	function U(t, e) {
		const s = 1e-5
		return (
			t.mode === e.mode &&
			t.sweep === e.sweep &&
			D(t.position, e.position, s) &&
			N(t.rotation, e.rotation, s) &&
			((t, e, s = 1e-5) => t.length === e.length && !Array.prototype.some.call(t, (t, i) => !I(t, e[i], s)))(
				t.projection,
				e.projection,
				s
			)
		)
	}
	function F(t, e) {
		;(t.sweep = e.sweep),
			(t.mode = e.mode),
			P(t.position, e.position),
			k(t.rotation, e.rotation),
			(function (t, e) {
				if (t.byteLength !== e.byteLength) throw new ArraySizeMismatchException()
				const s = e.length
				for (let i = 0; i < s; ++i) t[i] = e[i]
			})(t.projection, e.projection)
	}
	var V, j, W, L, B, H, q, K, Y, X, Q, Z
	!(function (t) {
		let e, s, i
		!(function (t) {
			t.PHASE_CHANGE = "application.phasechange"
		})((e = t.Event || (t.Event = {}))),
			(function (t) {
				;(t.UNINITIALIZED = "appphase.uninitialized"),
					(t.WAITING = "appphase.waiting"),
					(t.LOADING = "appphase.loading"),
					(t.STARTING = "appphase.starting"),
					(t.PLAYING = "appphase.playing"),
					(t.ERROR = "appphase.error")
			})((s = t.Phase || (t.Phase = {}))),
			(function (t) {
				t.SHOWCASE = "application.showcase"
			})((i = t.Application || (t.Application = {})))
	})(V || (V = {})),
		(function (t) {
			let e, s
			!(function (t) {
				t.MOVE = "camera.move"
			})((e = t.Event || (t.Event = {}))),
				(function (t) {
					;(t.FORWARD = "FORWARD"),
						(t.LEFT = "LEFT"),
						(t.RIGHT = "RIGHT"),
						(t.BACK = "BACK"),
						(t.UP = "UP"),
						(t.DOWN = "DOWN")
				})((s = t.Direction || (t.Direction = {})))
		})(j || (j = {})),
		(function (t) {
			let e
			!(function (t) {
				;(t.CHANGE_START = "floors.changestart"), (t.CHANGE_END = "floors.changeend")
			})((e = t.Event || (t.Event = {})))
		})(W || (W = {})),
		(function (t) {
			let e
			!(function (t) {
				t.POSITION_UPDATED = "label.positionupdated"
			})((e = t.Event || (t.Event = {})))
		})(L || (L = {})),
		(function (t) {
			let e, s, i, r, n
			!(function (t) {
				;(t.INSTANT = "transition.instant"), (t.FLY = "transition.fly"), (t.FADEOUT = "transition.fade")
			})((e = t.Transition || (t.Transition = {}))),
				(function (t) {
					;(t.NAVIGATION = "tag.link.nav"), (t.MODEL = "tag.link.model"), (t.EXT_LINK = "tag.link.ext")
				})((s = t.LinkType || (t.LinkType = {}))),
				(function (t) {
					;(t.NONE = "tag.chunk.none"), (t.TEXT = "tag.chunk.text"), (t.LINK = "tag.chunk.link")
				})((i = t.DescriptionChunkType || (t.DescriptionChunkType = {}))),
				(function (t) {
					;(t.HOVER = "tag.hover"), (t.CLICK = "tag.click"), (t.LINK_OPEN = "tag.linkopen")
				})((r = t.Event || (t.Event = {}))),
				(function (t) {
					;(t.NONE = "mattertag.media.none"),
						(t.PHOTO = "mattertag.media.photo"),
						(t.VIDEO = "mattertag.media.video"),
						(t.RICH = "mattertag.media.rich")
				})((n = t.MediaType || (t.MediaType = {})))
		})(B || (B = {})),
		(function (t) {
			let e, s, i
			!(function (t) {
				;(t.INSIDE = "mode.inside"),
					(t.OUTSIDE = "mode.outside"),
					(t.DOLLHOUSE = "mode.dollhouse"),
					(t.FLOORPLAN = "mode.floorplan"),
					(t.TRANSITIONING = "mode.transitioning")
			})((e = t.Mode || (t.Mode = {}))),
				(function (t) {
					;(t.CHANGE_START = "viewmode.changestart"), (t.CHANGE_END = "viewmode.changeend")
				})((s = t.Event || (t.Event = {}))),
				(function (t) {
					;(t.INSTANT = "transition.instant"), (t.FLY = "transition.fly"), (t.FADEOUT = "transition.fade")
				})((i = t.TransitionType || (t.TransitionType = {})))
		})(H || (H = {})),
		(function (t) {
			let e
			!(function (t) {
				t.MODEL_LOADED = "model.loaded"
			})((e = t.Event || (t.Event = {})))
		})(q || (q = {})),
		(function (t) {
			let e
			!(function (t) {
				;(t.NONE = "intersectedobject.none"),
					(t.MODEL = "intersectedobject.model"),
					(t.TAG = "intersectedobject.tag"),
					(t.SWEEP = "intersectedobject.sweep"),
					(t.UNKNOWN = "intersectedobject.unknown")
			})((e = t.Colliders || (t.Colliders = {})))
		})(K || (K = {})),
		(function (t) {
			let e, s
			!(function (t) {
				;(t.CLICK = "INTERACTION.CLICK"),
					(t.HOVER = "INTERACTION.HOVER"),
					(t.DRAG = "INTERACTION.DRAG"),
					(t.DRAG_BEGIN = "INTERACTION.DRAG_BEGIN"),
					(t.DRAG_END = "INTERACTION.DRAG_END"),
					(t.POINTER_MOVE = "INTERACTION.POINTER_MOVE"),
					(t.POINTER_BUTTON = "INTERACTION.POINTER_BUTTON"),
					(t.SCROLL = "INTERACTION.SCROLL"),
					(t.KEY = "INTERACTION.KEY"),
					(t.LONG_PRESS_START = "INTERACTION.LONG_PRESS_START"),
					(t.LONG_PRESS_END = "INTERACTION.LONG_PRESS_END"),
					(t.MULTI_SWIPE = "INTERACTION.MULTI_SWIPE"),
					(t.MULTI_SWIPE_END = "INTERACTION.MULTI_SWIPE_END"),
					(t.PINCH = "INTERACTION.PINCH"),
					(t.PINCH_END = "INTERACTION.PINCH_END"),
					(t.ROTATE = "INTERACTION.ROTATE"),
					(t.ROTATE_END = "INTERACTION.ROTATE_END")
			})((e = t.InteractionType || (t.InteractionType = {}))),
				(function (t) {
					;(t.INPUT = "input"), (t.OUTPUT = "output"), (t.EVENT = "event"), (t.EMIT = "emit")
				})((s = t.PathType || (t.PathType = {})))
		})(Y || (Y = {})),
		(function (t) {
			let e, s
			!(function (t) {
				t.CAMERA = "sensor.sensortype.camera"
			})((e = t.SensorType || (t.SensorType = {}))),
				(function (t) {
					;(t.SPHERE = "sensor.sourcetype.sphere"),
						(t.BOX = "sensor.sourcetype.box"),
						(t.CYLINDER = "sensor.sourcetype.cylinder")
				})((s = t.SourceType || (t.SourceType = {})))
		})(X || (X = {})),
		(function (t) {
			let e, s, i, r
			!(function (t) {
				;(t.ENTER = "sweep.enter"), (t.EXIT = "sweep.exit")
			})((e = t.Event || (t.Event = {}))),
				(function (t) {
					;(t.INSTANT = "transition.instant"), (t.FLY = "transition.fly"), (t.FADEOUT = "transition.fade")
				})((s = t.Transition || (t.Transition = {}))),
				(function (t) {
					;(t.ALIGNED = "aligned"), (t.UNALIGNED = "unaligned")
				})((i = t.Alignment || (t.Alignment = {}))),
				(function (t) {
					;(t.UNPLACED = "unplaced"), (t.AUTO = "auto"), (t.MANUAL = "manual")
				})((r = t.Placement || (t.Placement = {})))
		})(Q || (Q = {})),
		(function (t) {
			let e
			!(function (t) {
				;(t.STARTED = "tour.started"),
					(t.STOPPED = "tour.stopped"),
					(t.ENDED = "tour.ended"),
					(t.STEPPED = "tour.stepped")
			})((e = t.Event || (t.Event = {})))
		})(Z || (Z = {}))
	const G = Math.PI / 180
	class CoordinateConverter {
		constructor() {
			;(this.tempEuler = new Euler()),
				(this.tempPosition = new Vector3()),
				(this.camera = new Camera()),
				(this.cameraPose = null)
		}
		setCameraFromPose(t) {
			if (this.cameraPose && U(this.cameraPose, t)) return
			;(this.cameraPose = this.cameraPose || J), F(this.cameraPose, t)
			const e = t.position
			this.camera.position.set(e.x, e.y, e.z)
			const s = t.rotation
			this.tempEuler.set(s.x * G, s.y * G, 0, "YXZ"),
				this.camera.quaternion.setFromEuler(this.tempEuler),
				this.camera.updateMatrixWorld(),
				this.camera.projectionMatrix.fromArray(t.projection).transpose()
		}
		worldToNDC(t, e) {
			return (
				this.tempPosition.set(t.x, t.y, t.z),
				this.tempPosition.project(this.camera),
				((e = e || { x: 0, y: 0, z: 0 }).x = this.tempPosition.x),
				(e.y = this.tempPosition.y),
				(e.z = this.tempPosition.z),
				e
			)
		}
		worldToScreen(t, e, s) {
			return (
				((s = this.worldToNDC(t, s)).x = 0.5 * (this.tempPosition.x + 1) * e.w),
				(s.y = -0.5 * (this.tempPosition.y - 1) * e.h),
				t.z < -1 && ((s.x *= -1), (s.y *= -1)),
				s
			)
		}
	}
	const J = {
		sweep: "",
		mode: H.Mode.DOLLHOUSE,
		position: { x: 0, y: 0, z: 0 },
		rotation: { x: 0, y: 0 },
		projection: new Float32Array(16)
	}
	function $(t, e) {
		return (
			((e = e || { x: 0, y: 0, z: 0 }).x = t.anchorPosition.x),
			(e.y = t.anchorPosition.y),
			(e.z = t.anchorPosition.z),
			(e.x += t.stemVector.x),
			(e.y += t.stemVector.y),
			(e.z += t.stemVector.z),
			e
		)
	}
	class ClientInterface {
		constructor() {
			this.coordinateConverter = new CoordinateConverter()
		}
		build() {
			return {
				Conversion: {
					worldToScreen:
						((t = this.coordinateConverter),
						function (e, s, i, r) {
							return t.setCameraFromPose(s), t.worldToScreen(e, i, r)
						})
				},
				Mattertag: { getDiscPosition: $ }
			}
			var t
		}
	}
	class DisconnectMessage {
		constructor() {
			;(this.type = s.DISCONNECT), (this.payload = {})
		}
	}
	class SimplePostMessage {
		constructor(t, e, s) {
			;(this.sourceId = t),
				(this.targetId = e),
				(this.target = s),
				(this.messageHandlers = new DictArray()),
				(this.onMessage = t => {
					const { type: e, fromId: s, toId: i } = t.data
					if (s !== this.targetId || i !== this.sourceId) return
					const r = this.messageHandlers.getValuesAtKey(e)
					for (const e of r) e(...t.data.payload)
				}),
				window.addEventListener("message", this.onMessage)
		}
		updateTarget(t) {
			this.target = t
		}
		facade() {
			const t = this
			return new (class PostMessageFacade {
				dispose() {
					t.dispose()
				}
				on(e, s) {
					t.on(e, s)
				}
				off(e, s) {
					t.off(e, s)
				}
				send(e, ...s) {
					t.send(e, ...s)
				}
			})()
		}
		dispose() {
			window.removeEventListener("message", this.onMessage), (this.messageHandlers = new DictArray())
		}
		on(t, e) {
			this.messageHandlers.add(t, e)
		}
		off(t, e) {
			this.messageHandlers.remove(t, e)
		}
		send(t, ...e) {
			this.target.postMessage({ toId: this.targetId, fromId: this.sourceId, type: t, payload: e }, "*")
		}
	}
	var tt, et, st
	!(function (t) {
		;(t.LOADED = "inject.loaded"), (t.SETUP = "inject.setup"), (t.RESOLVE = "inject.resolve")
	})(tt || (tt = {})),
		(function (t) {
			t[(t.POSTMESSAGE = 1)] = "POSTMESSAGE"
		})(et || (et = {}))
	class InjectRoutine {
		constructor() {
			;(this.clientId = Math.floor(1e6 * Math.random())),
				(this.key = "mattertag.inject"),
				(this.argsDef = { argNames: ["tagId", "html", "options"], varArg: !1 })
		}
		buildMessageData(t, e) {
			return Object.assign(Object.assign({}, e), { clientId: this.clientId })
		}
		onResponse(t, e) {
			return new Promise(t => {
				let s
				if (e.messengerType === et.POSTMESSAGE) {
					const e = e => {
						const { toId: i, fromId: r } = e.data
						i === this.clientId &&
							e.data.type === tt.RESOLVE &&
							(s ? s.updateTarget(e.source) : ((s = new SimplePostMessage(this.clientId, r, e.source)), t(s.facade())))
					}
					window.addEventListener("message", e)
				}
			})
		}
	}
	!(function (t) {
		t.CAMERA = "sensor.sensortype.camera"
	})(st || (st = {}))
	const it = { namespace: "Sensor", name: "addSource", varArg: !0, args: ["sensorId", "sourceIds"] },
		rt = { namespace: "Sensor", name: "dispose", args: ["sensorId"] },
		nt = { namespace: "Sensor", name: "showDebug", args: ["sensorId", "show"] }
	var ot
	!(function (t) {
		t.map = new Map()
	})(ot || (ot = {}))
	class Sensor_Sensor {
		constructor(t, e, s, i) {
			;(this.id = t),
				(this.sensorCalls = e),
				(this.sensorState = s),
				(this.readingCollection = i),
				(this.origin = { x: 0, y: 0, z: 0 }),
				(this.forward = { x: 0, y: 0, z: -1 }),
				(this.sources = [])
			this.stateObservingCancellable = s.subscribe(
				new (class SensorObserver {
					constructor(t) {
						this.sensor = t
					}
					onChanged(t) {
						at(this.sensor.origin, t.origin), at(this.sensor.forward, t.forward)
					}
				})(this)
			)
		}
		dispose() {
			this.sensorCalls.dispose(this.id), this.stateObservingCancellable.cancel()
		}
		get facade() {
			const t = this
			class ObserverAdaptor {
				constructor(t) {
					this.observer = t
				}
				onChanged() {
					try {
						this.observerIsCallback(this.observer) ? this.observer(e) : this.observer.onChanged(e)
					} catch (t) {
						throw Error(
							"The argument provided to subscribe was not a valid observer\nExpected a function or an object with an `onChanged` function"
						)
					}
				}
				observerIsCallback(t) {
					return !t.onChanged
				}
			}
			class ConditionAdaptor {
				constructor(t) {
					this.condition = t
				}
				waitUntil() {
					try {
						return this.conditionIsCallback(this.condition) ? this.condition(e) : this.condition.waitUntil(e)
					} catch (t) {
						throw Error(
							"The argument provided to subscribe was not a valid waiter\nExpected a function or an object with an `waitUntil` function"
						)
					}
				}
				conditionIsCallback(t) {
					return !t.waitUntil
				}
			}
			const e = {
				get origin() {
					return t.origin
				},
				get forward() {
					return t.forward
				},
				addSource(...e) {
					t.addSource(...e)
				},
				showDebug(e) {
					t.sensorCalls.showDebug(t.id, e)
				},
				readings: { subscribe: e => t.readingCollection.subscribe(new CollectionObserverAdaptor(e, t.sources)) },
				dispose() {
					t.dispose()
				},
				subscribe: e => t.sensorState.subscribe(new ObserverAdaptor(e)),
				waitUntil: e => t.sensorState.waitUntil(new ConditionAdaptor(e))
			}
			return e
		}
		async addSource(...t) {
			this.sources.push(...t)
			const e = []
			for (const s of t) {
				const t = ot.map.get(s)
				if (!t) throw Error(s + " was not a valid source. Sources must be created using createSource")
				t.id && e.push(t.id)
			}
			this.sensorCalls.addSource(this.id, ...e)
		}
	}
	class CollectionObserverAdaptor {
		constructor(t, e) {
			;(this.observer = t),
				(this.sources = e),
				(this.sourceMap = new Map()),
				(this.internalReadingMap = new Map()),
				(this.readingMap = new Map())
		}
		onAdded(t, e) {
			const s = this.sources[this.sourceMap.size]
			if (s) {
				this.sourceMap.set(t, s)
				const i = new DerivedSensorReading(e)
				this.internalReadingMap.set(s, i),
					this.readingMap.set(s, i.facade),
					this.observer.onAdded && this.observer.onAdded(s, i.facade, this.readingMap)
			}
		}
		onRemoved(t, e) {
			const s = this.sourceMap.get(t)
			if (s) {
				const t = this.readingMap.get(s)
				this.internalReadingMap.delete(s),
					this.readingMap.delete(s),
					this.observer.onRemoved && this.observer.onRemoved(s, t, this.readingMap)
			}
		}
		onUpdated(t, e) {
			const s = this.sourceMap.get(t)
			if (s) {
				if ((this.internalReadingMap.get(s).update(e), this.observer.onUpdated)) {
					const t = this.readingMap.get(s)
					this.observer.onUpdated(s, t, this.readingMap)
				}
			}
		}
		onCollectionUpdated() {
			this.observer.onCollectionUpdated && this.observer.onCollectionUpdated(this.readingMap)
		}
	}
	class DerivedSensorReading {
		constructor(t) {
			;(this.baseReading = t), (this.distanceCache = 1 / 0), (this.distanceNeedsUpdate = !0)
		}
		get facade() {
			const t = this
			return {
				get inRange() {
					return t.baseReading.inRange
				},
				get inView() {
					return t.baseReading.inView
				},
				get distanceSquared() {
					return t.baseReading.distanceSquared
				},
				get direction() {
					return t.baseReading.direction
				},
				get distance() {
					return t.distance
				}
			}
		}
		update(t) {
			;(this.baseReading.inRange = t.inRange),
				(this.baseReading.inView = t.inView),
				this.updateDistance(t.distanceSquared),
				this.updateDirection(t.direction)
		}
		updateDirection(t) {
			at(this.baseReading.direction, t)
		}
		updateDistance(t) {
			t && ((this.distanceNeedsUpdate = !0), (this.baseReading.distanceSquared = t))
		}
		get distance() {
			return (
				this.distanceNeedsUpdate &&
					((this.distanceNeedsUpdate = !1), (this.distanceCache = Math.sqrt(this.baseReading.distanceSquared))),
				this.distanceCache
			)
		}
	}
	function at(t, e) {
		;(t.x = e.x), (t.y = e.y), (t.z = e.z)
	}
	class CreateSensorRoutine {
		constructor(t) {
			;(this.key = "sensor.create"),
				(this.argsDef = { argNames: ["type"], varArg: !1 }),
				(this.observableRegistry = t.observableRegister),
				(this.collectionRegistry = t.collectionRegister),
				(this.sensorCalls = {
					addSource: t.functionRegister.register("Sensor.addSource", it),
					dispose: t.functionRegister.register("sensor.dispose", rt),
					showDebug: t.functionRegister.register("sensor.showDebug", nt)
				})
		}
		buildMessageData(t, e) {
			return e
		}
		async onResponse(t, e) {
			const s = this.observableRegistry.register(e.sensorId),
				i = this.collectionRegistry.register(e.sensorId)
			return new Sensor_Sensor(e.sensorId, this.sensorCalls, s, i).facade
		}
	}
	const ht = { namespace: "Sensor", name: "updateSource", args: ["sourceId", "type", "options"] }
	var ct
	!(function (t) {
		;(t.SPHERE = "sensor.sourcetype.sphere"),
			(t.BOX = "sensor.sourcetype.box"),
			(t.CYLINDER = "sensor.sourcetype.cylinder")
	})(ct || (ct = {}))
	class SphereSource {
		constructor(t, e, s, i) {
			;(this.id = t),
				(this.updateSourceCall = e),
				(this.userData = s),
				(this.volumeCache = { origin: { x: 0, y: 0, z: 0 }, radius: 1 / 0 }),
				this.updateCache(i.origin, i.radius)
		}
		get facade() {
			const t = { radius: this.volumeCache.radius, origin: Object.assign({}, this.volumeCache.origin) }
			const e = this,
				s = new (class SphereFacade {
					get type() {
						return ct.SPHERE
					}
					get volume() {
						return t
					}
					get userData() {
						return e.userData
					}
					commit() {
						e.commit(this)
					}
				})()
			return ot.map.set(s, this), s
		}
		commit(t) {
			this.hasSourceChanged(t) &&
				(this.updateCache(t.volume.origin, t.volume.radius),
				this.updateSourceCall(this.id, ct.SPHERE, this.volumeCache))
		}
		hasSourceChanged(t) {
			return !(
				this.volumeCache.origin.x === t.volume.origin.x &&
				this.volumeCache.origin.y === t.volume.origin.y &&
				this.volumeCache.origin.z === t.volume.origin.z &&
				this.volumeCache.radius === t.volume.radius
			)
		}
		updateCache(t, e) {
			;(this.volumeCache.origin.x = t.x),
				(this.volumeCache.origin.y = t.y),
				(this.volumeCache.origin.z = t.z),
				(this.volumeCache.radius = e)
		}
	}
	class BoxSource {
		constructor(t, e, s, i) {
			;(this.id = t),
				(this.updateSourceCall = e),
				(this.userData = s),
				(this.volumeCache = {
					center: { x: 0, y: 0, z: 0 },
					size: { x: 1 / 0, y: 1 / 0, z: 1 / 0 },
					orientation: { yaw: 0, pitch: 0, roll: 0 }
				}),
				this.updateCache(i.center, i.size, i.orientation)
		}
		get facade() {
			const t = {
				center: Object.assign({}, this.volumeCache.center),
				size: Object.assign({}, this.volumeCache.size),
				orientation: Object.assign({}, this.volumeCache.orientation)
			}
			const e = this,
				s = new (class BoxFacade {
					get type() {
						return ct.BOX
					}
					get volume() {
						return t
					}
					get userData() {
						return e.userData
					}
					commit() {
						e.commit(this)
					}
				})()
			return ot.map.set(s, this), s
		}
		commit(t) {
			this.hasSourceChanged(t) &&
				(this.updateCache(t.volume.center, t.volume.size, t.volume.orientation),
				this.updateSourceCall(this.id, ct.BOX, this.volumeCache))
		}
		hasSourceChanged(t) {
			return !(
				this.volumeCache.center.x === t.volume.center.x &&
				this.volumeCache.center.y === t.volume.center.y &&
				this.volumeCache.center.z === t.volume.center.z &&
				this.volumeCache.size.x === t.volume.size.x &&
				this.volumeCache.size.y === t.volume.size.y &&
				this.volumeCache.size.z === t.volume.size.z &&
				this.volumeCache.orientation.yaw === t.volume.orientation.yaw &&
				this.volumeCache.orientation.pitch === t.volume.orientation.pitch &&
				this.volumeCache.orientation.roll === t.volume.orientation.roll
			)
		}
		updateCache(t, e, s) {
			P(this.volumeCache.center, t),
				P(this.volumeCache.size, e),
				(function (t, e, ...s) {
					for (const i of s) t[i] = e[i]
				})(this.volumeCache.orientation, s, "yaw", "pitch", "roll")
		}
	}
	class CylinderSource {
		constructor(t, e, s, i) {
			;(this.id = t),
				(this.updateSourceCall = e),
				(this.userData = s),
				(this.volumeCache = { basePoint: { x: 0, y: 0, z: 0 }, height: 1 / 0, radius: 1 / 0 }),
				this.updateCache(i.basePoint, i.height, i.radius)
		}
		get facade() {
			const t = {
				basePoint: Object.assign({}, this.volumeCache.basePoint),
				height: this.volumeCache.height,
				radius: this.volumeCache.radius
			}
			const e = this,
				s = new (class CylinderFacade {
					get type() {
						return ct.CYLINDER
					}
					get volume() {
						return t
					}
					get userData() {
						return e.userData
					}
					commit() {
						e.commit(this)
					}
				})()
			return ot.map.set(s, this), s
		}
		commit(t) {
			this.hasSourceChanged(t) &&
				(this.updateCache(t.volume.basePoint, t.volume.height, t.volume.radius),
				this.updateSourceCall(this.id, ct.CYLINDER, this.volumeCache))
		}
		hasSourceChanged(t) {
			return !(
				this.volumeCache.basePoint.x === t.volume.basePoint.x &&
				this.volumeCache.basePoint.y === t.volume.basePoint.y &&
				this.volumeCache.basePoint.z === t.volume.basePoint.z &&
				this.volumeCache.height === t.volume.height &&
				this.volumeCache.radius === t.volume.radius
			)
		}
		updateCache(t, e, s) {
			P(this.volumeCache.basePoint, t), (this.volumeCache.height = e), (this.volumeCache.radius = s)
		}
	}
	class CreateSourceRoutine {
		constructor(t) {
			;(this.userDataMap = new Map()),
				(this.key = "source.create"),
				(this.argsDef = { argNames: ["type", "options"], varArg: !1 }),
				(this.updateSourceCall = t.functionRegister.register("Sensor.updateSource", ht))
		}
		buildMessageData(t, e) {
			const s = e.options.hasOwnProperty("userData") ? e.options.userData : {}
			if (!(i = s) || "object" != typeof i)
				throw new Error("Error creating Source, userData was provided but not an object")
			var i
			this.userDataMap.set(t, Object.assign({}, s))
			const r = Object.assign({}, e.options)
			return delete r.userData, { type: e.type, options: r }
		}
		async onResponse(t, e) {
			const s = this.userDataMap.get(t) || {}
			return (
				this.userDataMap.delete(t),
				(function (t, e, s) {
					const { sourceId: i, type: r, volume: n } = t
					switch (r) {
						case ct.SPHERE:
							return new SphereSource(i, e, s, n)
						case ct.BOX:
							return new BoxSource(i, e, s, n)
						case ct.CYLINDER:
							return new CylinderSource(i, e, s, n)
					}
				})(e, this.updateSourceCall, s).facade
			)
		}
	}
	class RoomFactory {
		create(t, e) {
			const s = { x: 0, y: 0, z: 0 },
				i = { x: 0, y: 0, z: 0 }
			let r = !0,
				n = !0
			return (
				((e =
					e ||
					new (class RoomElement {
						constructor() {
							;(this.id = t.id),
								(this.floorInfo = Object.assign({}, t.floorInfo)),
								(this.bounds = { max: Object.assign({}, t.bounds.max), min: Object.assign({}, t.bounds.min) })
						}
						get size() {
							return (
								r &&
									((r = !1),
									(s.x = this.bounds.max.x - this.bounds.min.x),
									(s.y = this.bounds.max.y - this.bounds.min.y),
									(s.z = this.bounds.max.z - this.bounds.min.z)),
								s
							)
						}
						get center() {
							return (
								n &&
									((n = !1),
									(i.x = 0.5 * (this.bounds.max.x + this.bounds.min.x)),
									(i.y = 0.5 * (this.bounds.max.y + this.bounds.min.y)),
									(i.z = 0.5 * (this.bounds.max.z + this.bounds.min.z))),
								i
							)
						}
					})()).id = t.id),
				(e.floorInfo = Object.assign({}, t.floorInfo)),
				(e.bounds.min = Object.assign({}, t.bounds.min)),
				(e.bounds.max = Object.assign({}, t.bounds.max)),
				(r = !0),
				(n = !0),
				e
			)
		}
	}
	class RoomArrayFactory {
		constructor() {
			this.roomFactory = new RoomFactory()
		}
		create(t, e) {
			e = e || { rooms: [] }
			for (let s = 0; s < t.rooms.length; ++s) e.rooms[s] = this.roomFactory.create(t.rooms[s], e.rooms[s])
			return (e.rooms.length = t.rooms.length), e
		}
	}
	function lt(t, e) {
		const s = new e()
		return class {
			constructor() {
				this.observableKey = t
			}
			create(t, e) {
				return s.create(t, e)
			}
		}
	}
	function ut(t, e) {
		const s = new e()
		return class {
			constructor() {
				this.collectionKey = t
			}
			create(t, e) {
				return s.create(t, e)
			}
		}
	}
	function dt(t, e) {
		for (const s in t) {
			const i = t[s]
			if (i) {
				const r = e[s] || {}
				e[s] = r
				for (const r in t[s]) mt(s, r, i[r], e)
			}
		}
	}
	function mt(t, e, s, i) {
		const r = i[t] || {}
		;(i[t] = r), r[e] && console.warn(`clobbering ${e} in the ${t} namespace`), (r[e] = s)
	}
	class SdkBuilder {
		constructor(t) {
			;(this.messenger = t.createMessenger()),
				(this.functionRegistration = new FunctionRegistration(this.messenger)),
				(this.observableRegistration = new ObservableRegistration(this.messenger)),
				(this.collectionRegistration = new CollectionRegistration(this.messenger))
			const e = new (class RegistrationHelper {
					constructor(t) {
						this.sdkBuilder = t
					}
					get functionRegister() {
						return this.sdkBuilder.functionRegistration
					}
					get observableRegister() {
						return this.sdkBuilder.observableRegistration
					}
					get collectionRegister() {
						return this.sdkBuilder.collectionRegistration
					}
				})(this),
				s = [InjectRoutine, CreateSensorRoutine, CreateSourceRoutine]
			this.functionRegistration.initRoutines(e, ...s)
			const i = [lt("current.room", RoomArrayFactory)]
			this.observableRegistration.initObjectFactories(e, ...i)
			const r = [ut("collection.room", RoomFactory)]
			this.collectionRegistration.initElementFactories(e, ...r),
				(this.clientFcns = new ClientInterface()),
				(this.enums = new EnumInterfaceBuilder()),
				(this.eventHandler = new EventInterfaceBuilder(this.messenger)),
				(this.functions = new FunctionInterfaceBuilder(this.functionRegistration)),
				(this.observable = new ObservableInterfaceBuilder(this.observableRegistration)),
				(this.collections = new CollectionInterfaceBuilder(this.collectionRegistration)),
				this.messenger.init()
		}
		build(t) {
			const e = {},
				s = this.eventHandler.build()
			;(e.on = (t, i) => (s.on(t, i), e)), (e.off = (t, i) => (s.off(t, i), e))
			const i = [
				[this.enums, t.enums],
				[this.functions, t.functions],
				[this.observable, t.observables],
				[this.collections, t.collections]
			]
			for (const t of i)
				if (t[1]) {
					dt(t[0].build(t[1]), e)
				}
			return (
				dt(this.clientFcns.build(), e),
				(e.disconnect = () => {
					;(e.disconnect = () => {}), this.dispose()
				}),
				e
			)
		}
		dispose() {
			this.enums.dispose(),
				this.eventHandler.dispose(),
				this.functionRegistration.dispose(),
				this.observableRegistration.dispose(),
				this.collectionRegistration.dispose(),
				this.messenger.send(new DisconnectMessage()),
				this.messenger.dispose()
		}
	}
	window["sdk-client"] = r
})()
